- Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.37
- Fatal error: Cannot use $this as lexical variable in /in/BZ5k4 on line 7
Process exited with code 255.
<?php
class A {
private $value = 1;
public function getClosure()
{
return function() use ($this) { return $this->value; };
}
}
$a = new A;
$fn = $a->getClosure();
echo $fn(); // 1