3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class A { function f() { echo get_class($this); } } class B { function f() { A::f(); } } (new B)->f();
Output for 7.1.0
Deprecated: Non-static method A::f() should not be called statically in /in/bcEuY on line 7 Fatal error: Uncaught Error: Using $this when not in object context in /in/bcEuY:3 Stack trace: #0 /in/bcEuY(7): A::f() #1 /in/bcEuY(10): B->f() #2 {main} thrown in /in/bcEuY on line 3
Process exited with code 255.
Output for 7.0.0 - 7.0.14
Deprecated: Non-static method A::f() should not be called statically in /in/bcEuY on line 7 Notice: Undefined variable: this in /in/bcEuY on line 3 A
Output for 5.6.0 - 5.6.23
Deprecated: Non-static method A::f() should not be called statically, assuming $this from incompatible context in /in/bcEuY on line 7 B
Output for 5.4.0 - 5.5.37
Strict Standards: Non-static method A::f() should not be called statically, assuming $this from incompatible context in /in/bcEuY on line 7 B
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.29
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/bcEuY on line 10
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_OBJECT_OPERATOR in /in/bcEuY on line 10
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/bcEuY on line 10
Process exited with code 255.