3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php eval("\$foo = function() { echo 'hello!'; };"); $ref = new ReflectionFunction($foo); echo $ref;
Output for 7.0.0 - 7.1.0
Closure [ <user, prototype Closure> function {closure} ] { @@ /in/frKS5(5) : eval()'d code 1 - 3 }
Output for 5.3.0 - 5.6.28
Closure [ <user> function {closure} ] { @@ /in/frKS5(5) : eval()'d code 1 - 3 }
Output for 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_FUNCTION in /in/frKS5(5) : eval()'d code on line 1 Notice: Undefined variable: foo in /in/frKS5 on line 7 Fatal error: Uncaught exception 'ReflectionException' with message 'Function () does not exist' in /in/frKS5:7 Stack trace: #0 /in/frKS5(7): ReflectionFunction->__construct('') #1 {main} thrown in /in/frKS5 on line 7
Process exited with code 255.
Output for 5.0.4 - 5.0.5
Parse error: parse error, unexpected T_FUNCTION in /in/frKS5(5) : eval()'d code on line 1 Notice: Undefined variable: foo in /in/frKS5 on line 7 Fatal error: Uncaught exception 'ReflectionException' with message 'Function () does not exist' in /in/frKS5:7 Stack trace: #0 /in/frKS5(7): ReflectionFunction->__construct('') #1 {main} thrown in /in/frKS5 on line 7
Process exited with code 255.
Output for 5.0.3
Parse error: parse error, unexpected T_FUNCTION in /in/frKS5(5) : eval()'d code on line 1 Notice: Undefined variable: foo in /in/frKS5 on line 7 Fatal error: Uncaught exception 'ReflectionException' with message 'Function () does not exist' in /in/frKS5:7 Stack trace: #0 /in/frKS5(7): ReflectionFunction->__construct('') #1 {main} thrown in /in/frKS5 on line 7
Process exited with code 255.
Output for 5.0.0 - 5.0.2
Parse error: parse error, unexpected T_FUNCTION in /in/frKS5(5) : eval()'d code on line 1 Notice: Undefined variable: foo in /in/frKS5 on line 7 Fatal error: Uncaught exception 'ReflectionException' with message 'Function () does not exist' in /in/frKS5:7 Stack trace: #0 {main} thrown in /in/frKS5 on line 7
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_FUNCTION in /in/frKS5(5) : eval()'d code on line 1 Fatal error: Cannot instantiate non-existent class: reflectionfunction in /in/frKS5 on line 7
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_FUNCTION in /in/frKS5(5) : eval()'d code on line 1 Fatal error: Cannot instantiate non-existent class: reflectionfunction in /in/frKS5 on line 7
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/frKS5(5) : eval()'d code on line 1 Fatal error: Cannot instantiate non-existent class: reflectionfunction in /in/frKS5 on line 7
Process exited with code 255.