3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Foo { protected $d = 0; public function __construct() { $this->d = 1; } public static function doSomething() { return $this->d * 5; } } $foo = new Foo(); var_dump($foo->doSomething());
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Using $this when not in object context in /in/0CsLM:12 Stack trace: #0 /in/0CsLM(18): Foo::doSomething() #1 {main} thrown in /in/0CsLM on line 12
Process exited with code 255.
Output for 5.3.21 - 5.6.21
Fatal error: Using $this when not in object context in /in/0CsLM on line 12
Process exited with code 255.