How to access parent object from lambda functions?
The reference to $this
does not need to be explicitly passed to the lambda function.
class Foo { public $var = ''; public function bar() { $func = function() { echo $this->var; }; $func(); }}$foo = new Foo();$foo->var = 'It works!';$foo->bar(); // will echo 'It works!'