$a = function()
{
};
$b = 'value';
$a = $a use ($b);
use (&$b)
class Scope
{
public int $b = 1;
}
class Scope2
{
public int $b = 2;
}
$callback = function (int $a) {
return $a + $this->b;
};
$scope = new Scope();
$scope2 = new Scope2();
var_dump($callback->call($scope, 3), $callback->call($scope2, 3));