3v4l.org

run code in 300+ PHP versions simultaneously
<?php function foo() { $foo = array(); for($x = 0; $x < 10000; $x++){ $foo[] = rand(); } return $foo; } $t = microtime(true); for($x=0;$x<100000; $x++){ foreach(foo() as $val){ $val = $val + 2; } } echo round(microtime(true) - $t, 5)."\n"; $t = microtime(true); for($x=0;$x<100000; $x++){ $foo = foo(); foreach($foo as $val){ $val = $val + 2; } } echo round(microtime(true) - $t, 5)."\n";
Output for 5.3.4 - 5.3.29, 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.8 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.7

Process exited with code 137.

preferences:
103.3 ms | 403 KiB | 117 Q