3v4l.org

run code in 150+ 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();
Output for 7.1.0
Deprecated: Non-static method A::foo() should not be called statically in /in/L4Hts on line 10 Fatal error: Uncaught Error: Using $this when not in object context in /in/L4Hts:5 Stack trace: #0 /in/L4Hts(10): A::foo() #1 /in/L4Hts(14): B->bar() #2 {main} thrown in /in/L4Hts on line 5
Process exited with code 255.
Output for 7.0.0 - 7.0.14
Deprecated: Non-static method A::foo() should not be called statically in /in/L4Hts on line 10 Notice: Undefined variable: this in /in/L4Hts on line 5 string(1) "A"
Output for hhvm-3.10.0 - 3.12.0
Notice: Undefined variable: this in /in/L4Hts on line 5 string(1) "A"
Output for 5.6.0 - 5.6.28
Deprecated: Non-static method A::foo() should not be called statically, assuming $this from incompatible context in /in/L4Hts on line 10 string(1) "B"
Output for 5.1.3 - 5.5.38
Strict Standards: Non-static method A::foo() should not be called statically, assuming $this from incompatible context in /in/L4Hts on line 10 string(1) "B"
Output for 5.0.0 - 5.1.2
string(1) "B"
Output for 4.3.0 - 4.4.9
string(1) "b"