- Output for 5.3.0 - 5.3.28, 5.4.0 - 5.4.28
- Fatal error: Cannot use $this as lexical variable in /in/ZorRb on line 9
Process exited with code 255.
<?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());