3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $Foo = call_user_func(function() { $a = function() { return 'hello'; }; $b = function() { return 'world'; }; return (object)array( 'a' => $a, 'b' => $b, ); }); echo '<pre>'; print_r($Foo); echo '</pre>'; echo implode(' ', array($Foo->a(), $Foo->b()));
based on rrI5f
Output for 7.0.0 - 7.2.0
<pre>stdClass Object ( [a] => Closure Object ( ) [b] => Closure Object ( ) ) </pre> Fatal error: Uncaught Error: Call to undefined method stdClass::a() in /in/B6Zeq:18 Stack trace: #0 {main} thrown in /in/B6Zeq on line 18
Process exited with code 255.
Output for 5.3.18 - 5.6.28
<pre>stdClass Object ( [a] => Closure Object ( ) [b] => Closure Object ( ) ) </pre> Fatal error: Call to undefined method stdClass::a() in /in/B6Zeq on line 18
Process exited with code 255.