3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Test { private $baz = 1; public static function foo() { echo "foo\n"; $this->bar(); } public function bar() { echo "bar\n"; } } Test::foo();
based on DnSUk
Output for 7.0.0 - 7.2.0
foo Fatal error: Uncaught Error: Using $this when not in object context in /in/WmDoc:10 Stack trace: #0 /in/WmDoc(19): Test::foo() #1 {main} thrown in /in/WmDoc on line 10
Process exited with code 255.
Output for 5.3.22 - 5.6.28
foo Fatal error: Using $this when not in object context in /in/WmDoc on line 10
Process exited with code 255.