3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $fruits = array("d" => "lemon", "a" => "orange", "b" => "banana", "c" => "apple"); function pram_alter($array, $key) { global $params; $params=array(); foreach ($array as $value) { $params="$$key = '$array';\n"; } } array_walk($fruits, 'pram_alter'); echo print_r($params); ?>
based on voB6J
Output for 4.3.0 - 4.3.10, 4.4.0 - 7.1.0
Warning: Invalid argument supplied for foreach() in /in/FjMpj on line 8 Warning: Invalid argument supplied for foreach() in /in/FjMpj on line 8 Warning: Invalid argument supplied for foreach() in /in/FjMpj on line 8 Warning: Invalid argument supplied for foreach() in /in/FjMpj on line 8 Array ( ) 1
Output for 4.3.11
Array ( ) 1