- Output for 5.3.0 - 5.3.27, 5.4.0 - 5.4.17
- Fatal error: Cannot use $this as lexical variable in /in/ZPseQ on line 12
Process exited with code 255.
<?php
class closurecaller
{
public function doSomething()
{
var_dump('i am called');
}
public function callClosure()
{
$closure = function() use (&$this) {
$this->doSomething();
};
return $closure;
}
}
$cc = new closurecaller();
call_user_func($cc->callClosure());