0

I am wondering what the "&" sign does in this callback function.

array_walk($array, function (& $item) {
   $item['new_key'] = $item['old_key'];
   unset($item['old_key']);
});
Bram Janssen
  • 1,057
  • 1
  • 9
  • 14
  • It indicates 'pass by value'. – Elanochecer Mar 27 '19 at 10:07
  • [Reference to `$item`](https://www.php.net/manual/en/language.references.pass.php). This means that the original variable `$item` will reflect any changes that occur to it within that callback. – Script47 Mar 27 '19 at 10:07

0 Answers0