3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class A { public function doStuff() { var_dump(get_class($this)); } } class B { public function doStuff() { A::doStuff(); } } $b = new B; $b->doStuff();
Output for 7.1.0
Deprecated: Non-static method A::doStuff() should not be called statically in /in/SXAhC on line 11 Fatal error: Uncaught Error: Using $this when not in object context in /in/SXAhC:5 Stack trace: #0 /in/SXAhC(11): A::doStuff() #1 /in/SXAhC(17): B->doStuff() #2 {main} thrown in /in/SXAhC on line 5
Process exited with code 255.
Output for 7.0.0 - 7.0.14
Deprecated: Non-static method A::doStuff() should not be called statically in /in/SXAhC on line 11 Notice: Undefined variable: this in /in/SXAhC on line 5 string(1) "A"
Output for hhvm-3.10.0 - 3.12.0
Notice: Undefined variable: this in /in/SXAhC on line 5 string(1) "A"
Output for 5.6.7 - 5.6.28
Deprecated: Non-static method A::doStuff() should not be called statically, assuming $this from incompatible context in /in/SXAhC on line 11 string(1) "B"
Output for 5.3.7 - 5.5.35
Strict Standards: Non-static method A::doStuff() should not be called statically, assuming $this from incompatible context in /in/SXAhC on line 11 string(1) "B"