3v4l.org

run code in 300+ PHP versions simultaneously
<?php class foo { static function bar() { echo self::class, ' vs ', static::class, PHP_EOL; } static function bar1() { echo self::class, ' vs ', static::class, PHP_EOL; } } class baz extends foo { static function bar() { echo self::class, ' vs ', static::class, PHP_EOL; } } $r = new ReflectionClass('baz'); $m = $r->getMethod('bar1'); // without overriden method - it's ok, our static scope is preserved. Out: foo vs baz $m->invoke(null); $r = new ReflectionClass('baz'); $m = $r->getMethod('bar'); // with overriden method it's impossible to call parent static method. Out: baz vs baz $m->invoke(null); // how to statically call the parent static method bar() with scope == baz??
Output for git.master, git.master_jit, rfc.property-hooks
foo vs baz baz vs baz

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:
27.44 ms | 405 KiB | 5 Q