3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $arr = array_fill(0, 10000, '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 7.1.0
First: 0.00048852181434631 Second: 0.00070803833007813
Output for 7.0.14
First: 0.00017156529426575 Second: 0.00019199967384338
Output for 7.0.6
First: 0.00033058595657349 Second: 0.00037145829200745
Output for 7.0.5
First: 0.00032100796699524 Second: 0.00036393284797668
Output for 7.0.4
First: 0.00032181596755981 Second: 0.00036655235290527
Output for 7.0.3
First: 0.00033837842941284 Second: 0.00038164472579956
Output for 7.0.2
First: 0.00032017779350281 Second: 0.00035899233818054
Output for 7.0.1
First: 0.00032653474807739 Second: 0.00035654354095459
Output for 7.0.0
First: 0.00034007167816162 Second: 0.0003746919631958
Output for hhvm-3.12.0
First: 0.00093951892852783 Second: 0.00098324847221375
Output for hhvm-3.10.0
First: 0.0011127099990845 Second: 0.0010868186950684
Output for 5.0.0 - 5.6.28

Process exited with code 137.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected '&', expecting T_VARIABLE or '$' in /in/4ds27 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/4ds27 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/4ds27 on line 19
Process exited with code 255.
Output for 4.3.0
Parse error: parse error, unexpected '&', expecting T_VARIABLE or '$' in /in/vOAnR on line 19
Process exited with code 255.