3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php namespace Foo { function __lambda_func() { return print 'no'; } } namespace Bar { function yuno($x) { $x(); } } namespace { Bar\yuno(function() { return print 'OK'; }); $fn = create_function("xyz", "return 'OK';"); var_dump($fn()); }
based on kiull
Output for 7.2.0
OK Deprecated: Function create_function() is deprecated in /in/BuViW on line 19 Parse error: syntax error, unexpected ')', expecting variable (T_VARIABLE) in /in/BuViW(19) : runtime-created function on line 1
Process exited with code 255.
Output for 7.0.0 - 7.1.10
OK Parse error: syntax error, unexpected ')', expecting variable (T_VARIABLE) in /in/BuViW(19) : runtime-created function on line 1
Process exited with code 255.
Output for 5.6.8 - 5.6.28
OK Parse error: syntax error, unexpected ')', expecting variable (T_VARIABLE) in /in/BuViW(19) : runtime-created function on line 1 Fatal error: Function name must be a string in /in/BuViW on line 20
Process exited with code 255.
Output for 5.4.9 - 5.5.35
OK Parse error: syntax error, unexpected ')', expecting '&' or variable (T_VARIABLE) in /in/BuViW(19) : runtime-created function on line 1 Fatal error: Function name must be a string in /in/BuViW on line 20
Process exited with code 255.
Output for 5.3.19 - 5.3.29
OK Parse error: syntax error, unexpected ')', expecting '&' or T_VARIABLE in /in/BuViW(19) : runtime-created function on line 1 Fatal error: Function name must be a string in /in/BuViW on line 20
Process exited with code 255.