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(); }; $o = $b->bindTo(new A()); echo $o->fruit; } call_user_func(getfunc());
based on 311YT
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Closure object cannot have properties in /in/YQPY8:13 Stack trace: #0 /in/YQPY8(16): getfunc() #1 {main} thrown in /in/YQPY8 on line 13
Process exited with code 255.
Output for 5.4.0 - 5.6.28
Catchable fatal error: Closure object cannot have properties in /in/YQPY8 on line 13
Process exited with code 255.
Output for 5.3.19 - 5.3.29
Fatal error: Call to undefined method Closure::bindTo() in /in/YQPY8 on line 12
Process exited with code 255.