- var_dump: documentation ( source)
<?php
class Test
{
static function blah()
{
$a = new static(function(){ echo $this->bobo; });
return $a;
}
public $clos;
public $bobo = 22;
function __construct(\Closure $c)
{
$this->clos = $c->bindTo($this, $this);
var_dump($this->clos, $c);
}
}
$a = Test::blah();
$ss = $a->clos;
$ss();