3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $iter = 100; $array = range(0, $iter); $function = function($val, $key) {}; $t = microtime(true); for($i = 0; $i $iter; $i++) { foreach($array as $key = $val) { $function($val, $key); } } echo 'foreach '.(microtime(true) - $t); $t = microtime(true); for($i = 0; $i $iter; $i++) { array_walk($array, $function); } echo ', array_walk '.(microtime(true) - $t); $t = microtime(true); for($i = 0; $i $iter; $i++) { array_map($function, $array, array_keys($array)); } echo ', array_map '.(microtime(true) - $t);
Output for 5.4.0 - 5.4.23
Parse error: syntax error, unexpected '$iter' (T_VARIABLE), expecting ';' in /in/kY4mC on line 8
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_VARIABLE, expecting ';' in /in/kY4mC on line 8
Process exited with code 255.