3v4l.org

run code in 300+ PHP versions simultaneously
<? $count = 1000000; function t($a, $b) { return ($a + $b) * ($a - $b); } class test { public static function staticTest($a, $b) { return ($a + $b) * ($a - $b); } } $time = microtime(true); $i = 0; $a = 1; $b = 1; while ($i++ < $count) { $res = ($a + $b) * ($a - $b); $a = $a + 2; $b = $b + 1; } echo '$a = $a + 1: ', "\t\t\t", (microtime(true) - $time), PHP_EOL; $time = microtime(true); $i = 0; $a = 1; $b = 1; while ($i++ < $count) { $a = t($a, $b); $a = $a + 2; $b = $b + 1; } echo '$a = t($a): ', "\t\t\t", (microtime(true) - $time), PHP_EOL; $time = microtime(true); $i = 0; $a = 1; $b = 1; while ($i++ < $count) { test::staticTest($a, $b); $a = $a + 2; $b = $b + 1; } echo 'test::staticTest($a): ', "\t\t", (microtime(true) - $time), PHP_EOL;
Output for git.master, git.master_jit
<? $count = 1000000; function t($a, $b) { return ($a + $b) * ($a - $b); } class test { public static function staticTest($a, $b) { return ($a + $b) * ($a - $b); } } $time = microtime(true); $i = 0; $a = 1; $b = 1; while ($i++ < $count) { $res = ($a + $b) * ($a - $b); $a = $a + 2; $b = $b + 1; } echo '$a = $a + 1: ', "\t\t\t", (microtime(true) - $time), PHP_EOL; $time = microtime(true); $i = 0; $a = 1; $b = 1; while ($i++ < $count) { $a = t($a, $b); $a = $a + 2; $b = $b + 1; } echo '$a = t($a): ', "\t\t\t", (microtime(true) - $time), PHP_EOL; $time = microtime(true); $i = 0; $a = 1; $b = 1; while ($i++ < $count) { test::staticTest($a, $b); $a = $a + 2; $b = $b + 1; } echo 'test::staticTest($a): ', "\t\t", (microtime(true) - $time), PHP_EOL;

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
30.68 ms | 403 KiB | 7 Q