3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $fruits = array("d" => "lemon", "a" => "orange", "b" => "banana", "c" => "apple"); function test_alter(&$item1, $key, $prefix) { $item1 = "$item1 : $prefix"; } function test_print($item2, $key) { echo "$key. $item2\n"; } echo "Before ...:\n"; array_walk($fruits, 'test_print'); // array_walk($fruits, 'test_alter', 'fruit'); echo "... and after:\n"; array_walk(&fruits,'test_alter','fruit'); array_walk($fruits, 'test_print'); ?>
based on k7CgJ
Output for 7.0.0 - 7.0.2
Parse error: syntax error, unexpected '&' in /in/BcGrj on line 19
Process exited with code 255.
Output for 5.5.24 - 5.6.17
Parse error: syntax error, unexpected ',', expecting '(' in /in/BcGrj on line 19
Process exited with code 255.
Output for 5.4.11 - 5.4.45
Parse error: syntax error, unexpected ',', expecting :: (T_PAAMAYIM_NEKUDOTAYIM) in /in/BcGrj on line 19
Process exited with code 255.
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected ',', expecting T_PAAMAYIM_NEKUDOTAYIM in /in/BcGrj on line 19
Process exited with code 255.