3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public static function test() { return true; } } function test() { static $a; return $a ??= new A; } $its = 1e3; $test = test(); $t = hrtime(true); for ( $i=0;$i++<$its;) test()->test(); echo (hrtime(true)-$t)/1e9,"s\n"; $t = hrtime(true); for ( $i=0;$i++<$its;) $test->test(); echo (hrtime(true)-$t)/1e9,"s\n"; $t = hrtime(true); for ( $i=0;$i++<$its;) A::test(); echo (hrtime(true)-$t)/1e9,"s\n"; echo "\n=== Warmed up ===\n\n"; $its = 1e6; $t = hrtime(true); for ( $i=0;$i++<$its;) test()->test(); echo $a=(hrtime(true)-$t)/1e9,"s\n"; $t = hrtime(true); for ( $i=0;$i++<$its;) $test->test(); echo $b=(hrtime(true)-$t)/1e9,"s\n"; $t = hrtime(true); for ( $i=0;$i++<$its;) A::test(); echo $c=(hrtime(true)-$t)/1e9,"s\n"; echo number_format((($a-$c)/$a) * 100, 2 ), "% faster from function\n"; echo number_format((($b-$c)/$b) * 100, 2 ), "% faster from variable\n";
Output for git.master, git.master_jit
/bin/php-git-master: error while loading shared libraries: libonig.so.5: cannot open shared object file: No such file or directory
Process exited with code 127.
Output for rfc.property-hooks
2.8473E-5s 1.4932E-5s 1.4362E-5s === Warmed up === 0.027651334s 0.009022229s 0.009384153s 66.06% faster from function -4.01% faster from variable

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:
31.82 ms | 406 KiB | 5 Q