3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyClass { public function test() {echo __METHOD__ . "\n";} public static function testStatic() {echo __METHOD__ . "\n";} } class MyClass2 extends MyClass { public function test() { echo __METHOD__ . "\n"; $c = array('parent','test'); $c(); } public static function testStatic() { echo __METHOD__ . "\n"; $c = array('parent','testStatic'); $c(); $c = array('static','testLate'); $c(); } } class MyClass3 extends MyClass2 { public static function testLate() {echo __METHOD__ . "\n";} } echo "call object method:\n"; $o = new MyClass3(); $o->test(); $o->testStatic(); echo "call static method:\n"; MyClass3::testStatic();
Output for git.master, git.master_jit, rfc.property-hooks
call object method: MyClass2::test Fatal error: Uncaught Error: Class "parent" not found in /in/XoZSg:12 Stack trace: #0 /in/XoZSg(31): MyClass2->test() #1 {main} thrown in /in/XoZSg on line 12
Process exited with code 255.

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