3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class A { public static function hi() { echo __CLASS__,' -> A'; } public static function test() { // self::hi(); // 调用当前A类 A::hi(); 输出 A -> A // static::hi(); // 调用子B类 B::hi()覆盖了A::hi(); 输出 B -> B static::child(); // 调用子B类 B::child() // self::child(); // Fatal error: Call to undefined method A::child() } } class B extends A { public static function hi() { echo __CLASS__,' -> B'; } public static function child() { echo 'child'; } } B::test(); A::test();
based on OmiBt
Output for 7.0.0 - 7.3.0beta1
child Fatal error: Uncaught Error: Call to undefined method A::child() in /in/gf1vV:10 Stack trace: #0 /in/gf1vV(25): A::test() #1 {main} thrown in /in/gf1vV on line 10
Process exited with code 255.
Output for hhvm-3.22.0
child Fatal error: Uncaught Error: Call to undefined method A::child() in /in/gf1vV:-1 Stack trace: #0 /in/gf1vV(-1): A::test() #1 {main}
Process exited with code 255.
Output for hhvm-3.18.5 - 3.21.3
child Fatal error: Uncaught Error: Call to undefined method A::child() in /in/gf1vV:10 Stack trace: #0 /in/gf1vV(25): A::test() #1 {main}
Process exited with code 255.
Output for 5.6.0 - 5.6.30
child Fatal error: Call to undefined method A::child() in /in/gf1vV on line 10
Process exited with code 255.