3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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);
based on Ij0Qg
Output for 7.2.0 - 7.2.6
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 - 7.1.20
array(5) { ["abc"]=> int(123) ["def"]=> int(456) ["test.123"]=> string(3) "hip" ["test.hop.tip"]=> string(3) "top" ["test.hop.top"]=> NULL }