3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $arr = array_fill(0, 1000000, 'xxxxx'); $runs = 1000; $first = 0.0; $second = 0.0; for ($i =0; $i < $runs; $i++) { $start = microtime(true); foreach ($arr as $value) { strpos('xxxxxxx', $value); } $end = microtime(true) $first += ($end-$start); $start = microtime(true); foreach ($arr as &$value) { strpos('xxxxxxx', $value); } $end = microtime(true) $second += ($end-$start); } print "First: " . ($first/$runs) . PHP_EOL; print "Second: " . ($second/$runs) . PHP_EOL;
Output for 5.4.0 - 5.4.17
Parse error: syntax error, unexpected '$first' (T_VARIABLE) in /in/cZUEk on line 16
Process exited with code 255.
Output for 5.3.0 - 5.3.27
Parse error: syntax error, unexpected T_VARIABLE in /in/cZUEk on line 16
Process exited with code 255.