3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class A { private $fruit = 'pear'; } function getfunc() { $b = function() { $a = function() { return 'apple'; }; echo $a(),"\n"; return $this->fruit; }; $x=$b->bindTo(new A(),"A"); return $x(); } echo getfunc();
based on Yestu
Output for 5.4.0 - 7.2.0
apple pear