3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Foo { public $clbk; public function __construct($b = false) { if($b) { $f = new self(); $this->clbk = function() use ($f) { return $f; }; } } } $f = new Foo(true); var_dump($f->clbk());
based on LEngc
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Call to undefined method Foo::clbk() in /in/qC8MP:16 Stack trace: #0 {main} thrown in /in/qC8MP on line 16
Process exited with code 255.
Output for 5.3.17 - 5.6.28
Fatal error: Call to undefined method Foo::clbk() in /in/qC8MP on line 16
Process exited with code 255.