3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Base { public static function foo() { return static::class; } public static function bar() { return get_called_class(); } } class Child extends Base {} profile("Parent, static::class", function () { Base::foo();}); profile("Parent, get_called_class", function () { Base::bar();}); profile("Child, static::class", function () { Child::foo();}); profile("Child, get_called_class", function () { Child::bar();}); function profile($what, callable $func) { static $previous; if (!$previous) $previous = microtime(true); for ($a = 0; $a<=1000000; $a++) { $func(); }; $now = microtime(true); echo sprintf("%s took %.4f seconds", $what, $now - $previous), PHP_EOL; $previous = $now; }
Output for git.master
Parent, static::class took 0.0349 seconds Parent, get_called_class took 0.0337 seconds Child, static::class took 0.0360 seconds Child, get_called_class took 0.0335 seconds
Output for git.master_jit
Parent, static::class took 0.0340 seconds Parent, get_called_class took 0.0316 seconds Child, static::class took 0.0360 seconds Child, get_called_class took 0.0348 seconds

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