3v4l.org

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