3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $blah= array(array('a'=> 1, 'b' => array('inner' => 2))); $blank = array(); function _test(&$test, &$blank) { foreach ($test as $key => $value) { if (is_array($value) === false) continue; $clonedArray = array(); $clonedArray = array_merge($clonedArray, $test); unset($clonedArray[$key]['a']); $blank[$key] = $clonedArray; if (is_array($value) === true){ _test($test[$key]); } } } _test($blah); var_dump($blah);
based on C2Foh
Output for 7.1.0 - 7.2.0
Fatal error: Uncaught ArgumentCountError: Too few arguments to function _test(), 1 passed in /in/YpAUG on line 19 and exactly 2 expected in /in/YpAUG:5 Stack trace: #0 /in/YpAUG(19): _test(Array) #1 {main} thrown in /in/YpAUG on line 5
Process exited with code 255.
Output for 5.3.22 - 7.0.20
Warning: Missing argument 2 for _test(), called in /in/YpAUG on line 19 and defined in /in/YpAUG on line 5 Warning: Missing argument 2 for _test(), called in /in/YpAUG on line 14 and defined in /in/YpAUG on line 5 Warning: Missing argument 2 for _test(), called in /in/YpAUG on line 14 and defined in /in/YpAUG on line 5 array(1) { [0]=> array(2) { ["a"]=> int(1) ["b"]=> array(1) { ["inner"]=> int(2) } } }