- var_dump: documentation ( source)
<?php
function call($o, $a, $r, $context) {
$ref = new ReflectionFunction($o);
return $ref->invokeArgs($a);
}
class A
{
protected $a = 5;
public function __invoke()
{
$f = function () {
return $this->a;
};
return call($f, array(), array(), isset($this) ? $this : null);
}
}
$a = new A;
var_dump($a());