3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class A { function foo() { var_dump(get_class($this)); } } class B { function bar() { A::foo(); } } $b = new B; $b->bar();
based on Ftc9A
Output for 7.1.0 - 7.2.0
Deprecated: Non-static method A::foo() should not be called statically in /in/MvVqa on line 6 Fatal error: Uncaught Error: Using $this when not in object context in /in/MvVqa:3 Stack trace: #0 /in/MvVqa(6): A::foo() #1 /in/MvVqa(9): B->bar() #2 {main} thrown in /in/MvVqa on line 3
Process exited with code 255.
Output for 7.0.0 - 7.0.20
Deprecated: Non-static method A::foo() should not be called statically in /in/MvVqa on line 6 Notice: Undefined variable: this in /in/MvVqa on line 3 string(1) "A"
Output for 5.6.8 - 5.6.28
Deprecated: Non-static method A::foo() should not be called statically, assuming $this from incompatible context in /in/MvVqa on line 6 string(1) "B"
Output for 5.3.21 - 5.5.35
Strict Standards: Non-static method A::foo() should not be called statically, assuming $this from incompatible context in /in/MvVqa on line 6 string(1) "B"