3v4l.org

run code in 300+ PHP versions simultaneously
<?php function foo() { $bar = mt_rand(); } $iterations = 1000000; $a = microtime(true); for ($i = 0; $i < $iterations; $i++) { $bar = mt_rand(); } $b = microtime(true); for ($i = 0; $i < $iterations; $i++) { foo(); } $c = microtime(true); $ab = $b - $a; $bc = $c - $b; $abcPercent = (($bc / $ab) - 1) * 100; printf('Direct: %s seconds' . PHP_EOL, number_format($ab, 4)); printf('Function: %s seconds (%s%% more!)', number_format($bc, 4), number_format($abcPercent, 2));

preferences:
25.26 ms | 407 KiB | 5 Q