3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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"; call_user_func(array('parent','test')); } public static function testStatic() {echo __METHOD__ . "\n"; call_user_func(array('parent','testStatic')); call_user_func(array('static','testLate'));} } 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();
based on EBSib
Output for 5.4.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
call object method: MyClass2::test MyClass::test MyClass2::testStatic MyClass::testStatic MyClass3::testLate call static method: MyClass2::testStatic MyClass::testStatic MyClass3::testLate