3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class A { public function foo() { echo "hello world\n"; } } $closure = function(A $a) { return $a->foo(); }; $method = new ReflectionFunction($closure); var_dump($method);
based on cfHXc
Output for 5.3.0 - 5.6.38, 7.0.0 - 7.2.11
object(ReflectionFunction)#2 (1) { ["name"]=> string(9) "{closure}" }
Output for hhvm-3.21.0 - 3.22.0
object(ReflectionFunction)#2 (3) { ["name"]=> string(9) "{closure}" ["closure":"ReflectionFunction":private]=> object(Closure$;4)#1 (1) { ["parameter"]=> array(1) { ["$a"]=> string(10) "<required>" } } ["params":"ReflectionFunctionAbstract":private]=> NULL }
Output for hhvm-3.17.3 - 3.20.2
object(ReflectionFunction)#2 (3) { ["name"]=> string(9) "{closure}" ["closure":"ReflectionFunction":private]=> object(Closure$;2)#1 (1) { ["parameter"]=> array(1) { ["$a"]=> string(10) "<required>" } } ["params":"ReflectionFunctionAbstract":private]=> NULL }
Output for hhvm-3.15.4
object(ReflectionFunction)#2 (3) { ["name"]=> string(9) "{closure}" ["closure":"ReflectionFunction":private]=> object(Closure$foo;822329406$f06f516e7ce08c217c56353f1861909b$)#1 (1) { ["parameter"]=> array(1) { ["$a"]=> string(10) "<required>" } } ["params":"ReflectionFunctionAbstract":private]=> NULL }
Output for hhvm-3.12.14 - 3.13.2
object(ReflectionFunction)#2 (3) { ["name"]=> string(9) "{closure}" ["closure":"ReflectionFunction":private]=> object(Closure$foo;822329406$af2dc883ceae937697b387a9018872fb$)#1 (1) { ["parameter"]=> array(1) { ["$a"]=> string(10) "<required>" } } ["params":"ReflectionFunctionAbstract":private]=> NULL }
Output for hhvm-3.11.1
object(ReflectionFunction)#2 (3) { ["name"]=> string(9) "{closure}" ["closure":"ReflectionFunction":private]=> object(Closure$foo;822329406$a32e4c68dd08a73a982e320afce71f$)#1 (1) { ["parameter"]=> array(1) { ["$a"]=> string(10) "<required>" } } ["params":"ReflectionFunctionAbstract":private]=> NULL }
Output for hhvm-3.10.1
object(ReflectionFunction)#2 (3) { ["name"]=> string(9) "{closure}" ["closure":"ReflectionFunction":private]=> object(Closure$foo;822329406$a4aaf7ea76e1546d5ef08d1adaeb1762$)#1 (1) { ["parameter"]=> array(1) { ["$a"]=> string(10) "<required>" } } ["params":"ReflectionFunctionAbstract":private]=> NULL }
Output for 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_FUNCTION in /in/HUGVK on line 9
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_FUNCTION in /in/HUGVK on line 9
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/HUGVK on line 3
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_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/HUGVK on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/HUGVK on line 3
Process exited with code 255.