3v4l.org

run code in 300+ PHP versions simultaneously
<?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 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Fatal error: Uncaught Error: Non-static method A::doStuff() cannot be called statically in /in/SXAhC:11 Stack trace: #0 /in/SXAhC(17): B->doStuff() #1 {main} thrown in /in/SXAhC on line 11
Process exited with code 255.
Output for 7.1.0 - 7.1.20, 7.2.6 - 7.2.33, 7.3.12 - 7.3.31, 7.4.0 - 7.4.25, 7.4.27 - 7.4.33
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.3.32 - 7.3.33, 7.4.26
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.20
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 5.6.0 - 5.6.30
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.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38
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"

preferences:
211.84 ms | 402 KiB | 317 Q