3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class CFoo { public function foo() { $this->foo = 'foo'; } } class CBar { public function bar() { CFoo::foo(); } } $cBar = new CBar(); $cBar->bar(); echo $cBar->foo;
Output for 7.0.0 - 7.2.6
Deprecated: Non-static method CFoo::foo() should not be called statically in /in/i11b9 on line 11 Fatal error: Uncaught Error: Using $this when not in object context in /in/i11b9:5 Stack trace: #0 /in/i11b9(11): CFoo::foo() #1 /in/i11b9(16): CBar->bar() #2 {main} thrown in /in/i11b9 on line 5
Process exited with code 255.
Output for 5.6.0 - 5.6.29
Deprecated: Non-static method CFoo::foo() should not be called statically, assuming $this from incompatible context in /in/i11b9 on line 11 foo