3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Foo { protected $baz = 'foobar'; public function bar() { self::functionName(); $this->functionName(); } public static function functionName() { echo $this->baz . "\n"; } } $f = new Foo(); $f->bar();
based on NPQn6
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Using $this when not in object context in /in/vroKV:15 Stack trace: #0 /in/vroKV(9): Foo::functionName() #1 /in/vroKV(20): Foo->bar() #2 {main} thrown in /in/vroKV on line 15
Process exited with code 255.
Output for 5.3.19 - 5.6.28
Fatal error: Using $this when not in object context in /in/vroKV on line 15
Process exited with code 255.