- Output for 5.3.0 - 5.3.28, 5.4.0 - 5.4.30
- Fatal error: Cannot use $this as lexical variable in /in/5Nb15 on line 7
Process exited with code 255.
<?php
class Test {
public function publicMethod() {
return function() use ($this) {
return $this->privateMethod();
};
}
private function privateMethod() {
return 'works';
}
}
$test = new Test;
$testFunction = $test->publicMethod();
echo $testFunction();