3v4l.org

run code in 300+ PHP versions simultaneously
<?php $test = array( 'abc' => 123, 'def' => 456, 'test' => array( 123 => 'hip', 'hop' => array( 'tip' => 'top', 'top' => null ) ) ); while (list($old, $arr) = each($test)) { if (is_array($arr)) { unset($test[$old]); foreach ($arr as $new => $v) { $test["$old.$new"] = $v; } } } var_dump($test);
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.30, 8.2.0 - 8.2.25, 8.3.0 - 8.3.13
Fatal error: Uncaught Error: Call to undefined function each() in /in/851ov:15 Stack trace: #0 {main} thrown in /in/851ov on line 15
Process exited with code 255.
Output for 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.33
Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /in/851ov on line 15 array(5) { ["abc"]=> int(123) ["def"]=> int(456) ["test.123"]=> string(3) "hip" ["test.hop.tip"]=> string(3) "top" ["test.hop.top"]=> NULL }
Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.3.32 - 7.3.33
array(5) { ["abc"]=> int(123) ["def"]=> int(456) ["test.123"]=> string(3) "hip" ["test.hop.tip"]=> string(3) "top" ["test.hop.top"]=> NULL }

preferences:
79.81 ms | 411 KiB | 5 Q