3v4l.org

run code in 300+ PHP versions simultaneously
<?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;

preferences:
28.13 ms | 402 KiB | 5 Q