PHP Array_walk_recursive

$arr = array(1, array(2, 3));
// Call function on every item, even subarrays.
// Sign $item as reference to work on original item.
array_walk_recursive($arr, function(&$item, $key, $myParam){
  $item *= 2;
}, 'will be in myParam');
// $arr now is [2, [4, 6]]
TechNyquist