3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Foo { private $bar; public function getClosure($bar = 'foo') { $this->bar = $bar; return function () use ($this->bar => $bar) { return $bar; }; } } $foo = new Foo; $closure = $foo->getClosure(); var_dump($closure());
Output for 5.3.0 - 5.4.28
Fatal error: Cannot use $this as lexical variable in /in/ZorRb on line 9
Process exited with code 255.