3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Example { protected $foo = 'bar'; public function test() { $closure = function() use ($this->foo) { return $this->foo; }; return $closure(); } } $e = new Example; $c = $e->test(); echo $c;
Output for 5.3.0 - 5.4.6
Fatal error: Cannot use $this as lexical variable in /in/m53I9 on line 6
Process exited with code 255.