3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $func = function ($a) { var_dump($a); }; $obj = new stdClass; $obj->foo = $func; $obj->func();
Output for 7.0.0 - 7.1.0
Fatal error: Uncaught Error: Call to undefined method stdClass::func() in /in/c6ueS:8 Stack trace: #0 {main} thrown in /in/c6ueS on line 8
Process exited with code 255.
Output for 5.3.1 - 5.6.28
Fatal error: Call to undefined method stdClass::func() in /in/c6ueS on line 8
Process exited with code 255.
Output for 5.2.11 - 5.2.17
Parse error: syntax error, unexpected T_FUNCTION in /in/c6ueS on line 3
Process exited with code 255.