3v4l.org

run code in 150+ 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.0.0 - 5.2.0, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0

Process exited with code 137.
Output for 5.4.18 - 5.6.28
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 72 bytes) in /in/9PZkh on line 3
Process exited with code 255.
Output for 5.4.0 - 5.4.17
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 72 bytes) in /in/ptau0 on line 3
Process exited with code 255.
Output for 5.3.28 - 5.3.29
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 71 bytes) in /in/9PZkh on line 3
Process exited with code 255.
Output for 5.2.1 - 5.3.27
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 71 bytes) in /in/ptau0 on line 3
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected '&', expecting T_VARIABLE or '$' in /in/ptau0 on line 19
Process exited with code 255.
Output for 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected '&', expecting T_VARIABLE or '$' in /in/ptau0 on line 19
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_VARIABLE' or `'$'' in /in/ptau0 on line 19
Process exited with code 255.
Output for 4.3.0
Parse error: parse error, unexpected '&', expecting T_VARIABLE or '$' in /in/9PZkh on line 19
Process exited with code 255.