3v4l.org

run code in 200+ 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.2.0
First: 0.0003422257900238 Second: 0.00038205099105835
Output for 7.1.7
First: 0.00034904336929321 Second: 0.00038903522491455
Output for 7.1.6
First: 0.0003960645198822 Second: 0.00041754174232483
Output for 7.1.5
First: 0.00037942385673523 Second: 0.0003992030620575
Output for 7.1.0
First: 0.00048852181434631 Second: 0.00070803833007813
Output for 7.0.20
First: 0.00037244153022766 Second: 0.00041656374931335
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 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.