3v4l.org

run code in 300+ PHP versions simultaneously
<?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();

preferences:
40.09 ms | 402 KiB | 5 Q