The PHP manual offers little explanation about Closure::bind() and the example was confusing too.
Here's the code example on the site:
class A {
private static $sfoo = 1;
private $ifoo = 2;
}
$cl1 = static function() {
return A::$sfoo;
};
$cl2 = function() {
return $this->ifoo;
};
$bcl1 = Closure::bind($cl1, null, 'A');
$bcl2 = Closure::bind($cl2, new A(), 'A');
echo $bcl1(), "\n";
echo $bcl2(), "\n";
What are the parameters for Closure::bind()?
Null was used in the above, and even the "new" keyword was used too, which makes this even more confusing to me.