3v4l.org

run code in 300+ PHP versions simultaneously
<?php $tmp = $array = range(1, 1000); $t = microtime(1); for ($i = 0; $i < 1e4; $i++) foreach ($array as &$value) $value++; print "by ref: ".(microtime(1) - $t)."\n"; $array = $tmp; // reset $t = microtime(1); for ($i = 0; $i < 1e4; $i++) foreach ($array as $key => $value) $array[$key]++; print "by array[key]: ".(microtime(1) - $t)."\n";

preferences:
30.72 ms | 402 KiB | 5 Q