- var_dump: documentation ( source)
<?php
class IsolatedTest
{
protected $closure;
public function __construct($closure)
{
$this->closure = $closure;
}
public function __invoke()
{
call_user_func($this->closure);
}
}
class Test
{
public function testing(callable $what)
{
return Closure::bind($what, $this, $this);
}
}
$test = new IsolatedTest(function () {
echo 'This can be forked and called.';
});
$more = (new Test)->testing($test);
var_dump($more);