3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php phpinfo(); class Kitchen { private $yummy = 'cake'; } $kitchen = new Kitchen(); $cake = & Closure::bind(function & () { return $this->yummy; }, $kitchen, $kitchen)->__invoke(); var_dump($cake); $cake = 'the cake is a lie!'; // stole it! var_dump($kitchen);
Output for 5.4.0 - 7.1.0
Warning: phpinfo() has been disabled for security reasons in /in/tjNH2 on line 1 string(4) "cake" object(Kitchen)#1 (1) { ["yummy":"Kitchen":private]=> &string(18) "the cake is a lie!" }
Output for 5.3.0 - 5.3.29
Warning: phpinfo() has been disabled for security reasons in /in/tjNH2 on line 1 Fatal error: Call to undefined method Closure::bind() in /in/tjNH2 on line 10
Process exited with code 255.