3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ParentClass { public function foo() { echo __CLASS__, "\n"; echo get_class($this), "\n"; echo "\n"; } } class ChildClass extends ParentClass { public function foo() { echo __CLASS__, "\n"; echo get_class($this), "\n"; echo "\n"; } } $obj = new ChildClass(); // bind closure to $obj and use scope resolution operator (function () { ParentClass::foo(); })->call($obj); // use reflection (new \ReflectionMethod(ParentClass::class, 'foo'))->invoke($obj); // dg magic call_user_func([$obj, 'ParentClass::foo']);
Output for git.master, git.master_jit, rfc.property-hooks
ParentClass ChildClass ParentClass ChildClass Deprecated: Callables of the form ["ChildClass", "ParentClass::foo"] are deprecated in /in/vW3Yh on line 32 ParentClass ChildClass

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:
32.28 ms | 401 KiB | 8 Q