3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class A { function bb() { echo 'parent-'; } } trait B { function bb() { echo 'trait-'; parent::bb(); } } class C extends A { use B; function bb() { echo 'class-'; B::bb(); parent::bb(); } } $o=new C; $o->bb();
based on G5GNs
Output for 7.0.0 - 7.2.0
class- Deprecated: Non-static method B::bb() should not be called statically in /in/pWAfW on line 20 trait- Fatal error: Uncaught Error: Cannot access parent:: when current class scope has no parent in /in/pWAfW:12 Stack trace: #0 /in/pWAfW(20): B::bb() #1 /in/pWAfW(26): C->bb() #2 {main} thrown in /in/pWAfW on line 12
Process exited with code 255.
Output for 5.6.8 - 5.6.28
class- Deprecated: Non-static method B::bb() should not be called statically, assuming $this from incompatible context in /in/pWAfW on line 20 trait- Fatal error: Cannot access parent:: when current class scope has no parent in /in/pWAfW on line 12
Process exited with code 255.
Output for 5.4.11 - 5.5.35
class- Strict Standards: Non-static method B::bb() should not be called statically, assuming $this from incompatible context in /in/pWAfW on line 20 trait- Fatal error: Cannot access parent:: when current class scope has no parent in /in/pWAfW on line 12
Process exited with code 255.
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected T_STRING in /in/pWAfW on line 9
Process exited with code 255.