3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function func(&$data) { foreach ($data as $key => $value) { if (is_array($value)) { func($data[$key]); } } } $data = [ ['foo' => [0,1]], ['foo' => [2,3]], ]; func($data); echo ' pre: ' . json_encode($data) . "\n"; array_replace_recursive($data[0], $data[1]); echo 'post: ' . json_encode($data) . "\n";
based on qKHP9
Output for 5.5.0 - 5.6.28, 7.0.6 - 7.2.0
pre: [{"foo":[0,1]},{"foo":[2,3]}] post: [{"foo":[0,1]},{"foo":[2,3]}]
Output for 7.0.0 - 7.0.5
pre: [{"foo":[0,1]},{"foo":[2,3]}] post: [{"foo":[2,3]},{"foo":[2,3]}]