3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $data = array('one' => array( 'two' => 3, 'four' => array(5,6,7)),'eight' => array( 'nine'=> array('ten' =>11))); function aarray_to_vlue($akey,$val) { $array_key = array(); if(is_array($val)) { foreach($val as $key => $value) { if($akey != '') { $pkey = $akey.'/'.$key; } else { $pkey = $key; } if(is_array($value)) { $array_key = array_to_value($pkey,$value); } $array_key[$pkey] = $value; } return $array_key; } } print_r(aarray_to_vlue($data)); print_r($data);
Output for 7.1.0
Fatal error: Uncaught ArgumentCountError: Too few arguments to function aarray_to_vlue(), 1 passed in /in/K6tWo on line 23 and exactly 2 expected in /in/K6tWo:4 Stack trace: #0 /in/K6tWo(23): aarray_to_vlue(Array) #1 {main} thrown in /in/K6tWo on line 4
Process exited with code 255.
Output for 5.1.0 - 7.0.14
Warning: Missing argument 2 for aarray_to_vlue(), called in /in/K6tWo on line 23 and defined in /in/K6tWo on line 4 Notice: Undefined variable: val in /in/K6tWo on line 6 Array ( [one] => Array ( [two] => 3 [four] => Array ( [0] => 5 [1] => 6 [2] => 7 ) ) [eight] => Array ( [nine] => Array ( [ten] => 11 ) ) )
Output for 4.3.0 - 5.0.5
Warning: Missing argument 2 for aarray_to_vlue() in /in/K6tWo on line 4 Array ( [one] => Array ( [two] => 3 [four] => Array ( [0] => 5 [1] => 6 [2] => 7 ) ) [eight] => Array ( [nine] => Array ( [ten] => 11 ) ) )