3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php eval("$foo = function() { echo 'hello!'; };"); $ref = new ReflectionFunction($foo); echo $ref;
Output for 7.0.18 - 7.0.20, 7.1.4 - 7.2.0
Notice: Undefined variable: foo in /in/FLr77 on line 3 Parse error: syntax error, unexpected '=', expecting end of file in /in/FLr77(3) : eval()'d code on line 1
Process exited with code 255.
Output for 7.0.0 - 7.0.17, 7.1.0 - 7.1.3
Notice: Undefined variable: foo in /in/FLr77 on line 5 Parse error: syntax error, unexpected '=', expecting end of file in /in/FLr77(5) : eval()'d code on line 1
Process exited with code 255.
Output for hhvm-3.10.1 - 3.17.3
Notice: Undefined variable: foo in /in/FLr77 on line 5 Fatal error: syntax error, unexpected '=', expecting $end in /in/FLr77(5)(fbb42d335cbad67fb82294eb0960103e) : eval()'d code on line 1 Notice: Undefined variable: foo in /in/FLr77 on line 7 Fatal error: Uncaught exception 'ReflectionException' with message 'ReflectionFunction::__construct expects a string or a Closure, got NULL' in /in/FLr77:7 Stack trace: #0 /in/FLr77(7): ReflectionFunction->__construct() #1 {main}
Process exited with code 255.
Output for 5.2.3 - 5.6.30
Notice: Undefined variable: foo in /in/FLr77 on line 5 Parse error: syntax error, unexpected '=' in /in/FLr77(5) : eval()'d code on line 1 Notice: Undefined variable: foo in /in/FLr77 on line 7 Fatal error: Uncaught exception 'ReflectionException' with message 'Function () does not exist' in /in/FLr77:7 Stack trace: #0 /in/FLr77(7): ReflectionFunction->__construct('') #1 {main} thrown in /in/FLr77 on line 7
Process exited with code 255.
Output for 5.1.0 - 5.2.2
Notice: Undefined variable: foo in /in/FLr77 on line 3 Parse error: syntax error, unexpected '=' in /in/FLr77(5) : eval()'d code on line 1 Notice: Undefined variable: foo in /in/FLr77 on line 7 Fatal error: Uncaught exception 'ReflectionException' with message 'Function () does not exist' in /in/FLr77:7 Stack trace: #0 /in/FLr77(7): ReflectionFunction->__construct('') #1 {main} thrown in /in/FLr77 on line 7
Process exited with code 255.
Output for 5.0.4 - 5.0.5
Notice: Undefined variable: foo in /in/FLr77 on line 3 Parse error: parse error, unexpected '=' in /in/FLr77(5) : eval()'d code on line 1 Notice: Undefined variable: foo in /in/FLr77 on line 7 Fatal error: Uncaught exception 'ReflectionException' with message 'Function () does not exist' in /in/FLr77:7 Stack trace: #0 /in/FLr77(7): ReflectionFunction->__construct('') #1 {main} thrown in /in/FLr77 on line 7
Process exited with code 255.
Output for 5.0.3
Notice: Undefined variable: foo in /in/FLr77 on line 3 Parse error: parse error, unexpected '=' in /in/FLr77(5) : eval()'d code on line 1 Notice: Undefined variable: foo in /in/FLr77 on line 7 Fatal error: Uncaught exception 'ReflectionException' with message 'Function () does not exist' in /in/FLr77:7 Stack trace: #0 /in/FLr77(7): ReflectionFunction->__construct('') #1 {main} thrown in /in/FLr77 on line 7
Process exited with code 255.
Output for 5.0.0 - 5.0.2
Notice: Undefined variable: foo in /in/FLr77 on line 3 Parse error: parse error, unexpected '=' in /in/FLr77(5) : eval()'d code on line 1 Notice: Undefined variable: foo in /in/FLr77 on line 7 Fatal error: Uncaught exception 'ReflectionException' with message 'Function () does not exist' in /in/FLr77:7 Stack trace: #0 {main} thrown in /in/FLr77 on line 7
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Notice: Undefined variable: foo in /in/FLr77 on line 3 Parse error: syntax error, unexpected '=' in /in/FLr77(5) : eval()'d code on line 1 Fatal error: Cannot instantiate non-existent class: reflectionfunction in /in/FLr77 on line 7
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Notice: Undefined variable: foo in /in/FLr77 on line 3 Parse error: parse error, unexpected '=' in /in/FLr77(5) : eval()'d code on line 1 Fatal error: Cannot instantiate non-existent class: reflectionfunction in /in/FLr77 on line 7
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Notice: Undefined variable: foo in /in/FLr77 on line 3 Parse error: parse error in /in/FLr77(5) : eval()'d code on line 1 Fatal error: Cannot instantiate non-existent class: reflectionfunction in /in/FLr77 on line 7
Process exited with code 255.