- Output for 5.3.0 - 5.3.16, 5.4.0 - 5.4.6
- Fatal error: Cannot use $this as lexical variable in /in/m53I9 on line 6
Process exited with code 255.
<?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;