3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php use Other\Hierarchy\TheOtherNamespace; $a = function(\Some\Random\NS $b) { }; $b = function(TheOtherNamespace $c) { }; $handlers = [$b, $a]; foreach ($handlers as $handler) { $r = new ReflectionFunction($handler); $p = $r->getParameters(); var_dump($p[0]); var_dump($p[0]->getClass()); }
Output for 7.0.0 - 7.1.0
object(ReflectionParameter)#4 (1) { ["name"]=> string(1) "c" } Fatal error: Uncaught ReflectionException: Class Other\Hierarchy\TheOtherNamespace does not exist in /in/kP4Wf:20 Stack trace: #0 /in/kP4Wf(20): ReflectionParameter->getClass() #1 {main} thrown in /in/kP4Wf on line 20
Process exited with code 255.
Output for hhvm-3.12.0
object(ReflectionParameter)#4 (3) { ["info"]=> array(10) { ["index"]=> int(0) ["name"]=> string(1) "c" ["type"]=> string(33) "Other\Hierarchy\TheOtherNamespace" ["type_hint"]=> string(33) "Other\Hierarchy\TheOtherNamespace" ["type_hint_builtin"]=> bool(false) ["function"]=> string(8) "__invoke" ["class"]=> string(54) "Closure$#2;798256920$5c1b621b0bd06d9f299759bf1af9d3dd$" ["type_hint_nullable"]=> bool(false) ["attributes"]=> array(0) { } ["is_optional"]=> bool(false) } ["name"]=> string(1) "c" ["paramTypeInfo"]=> array(3) { ["name"]=> string(33) "Other\Hierarchy\TheOtherNamespace" ["nullable"]=> bool(false) ["builtin"]=> bool(false) } } Fatal error: Uncaught exception 'ReflectionException' with message 'Class Other\Hierarchy\TheOtherNamespace does not exist' in /in/kP4Wf:20 Stack trace: #0 /in/kP4Wf(20): ReflectionParameter->getClass() #1 {main}
Process exited with code 255.
Output for hhvm-3.10.0
object(ReflectionParameter)#4 (2) { ["info"]=> array(8) { ["index"]=> int(0) ["name"]=> string(1) "c" ["type"]=> string(33) "Other\Hierarchy\TheOtherNamespace" ["type_hint"]=> string(33) "Other\Hierarchy\TheOtherNamespace" ["function"]=> string(8) "__invoke" ["class"]=> string(54) "Closure$#2;798256920$ee8bcb1b701082ea570f5346de986939$" ["attributes"]=> array(0) { } ["is_optional"]=> bool(false) } ["name"]=> string(1) "c" } Fatal error: Uncaught exception 'ReflectionException' with message 'Class Other\Hierarchy\TheOtherNamespace does not exist' in /in/kP4Wf:20 Stack trace: #0 /in/kP4Wf(20): ReflectionParameter->getClass() #1 {main}
Process exited with code 255.
Output for 5.4.0 - 5.6.21
object(ReflectionParameter)#4 (1) { ["name"]=> string(1) "c" } Fatal error: Uncaught exception 'ReflectionException' with message 'Class Other\Hierarchy\TheOtherNamespace does not exist' in /in/kP4Wf:20 Stack trace: #0 /in/kP4Wf(20): ReflectionParameter->getClass() #1 {main} thrown in /in/kP4Wf on line 20
Process exited with code 255.
Output for 5.3.0 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/kP4Wf on line 14
Process exited with code 255.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_STRING, expecting T_CONSTANT_ENCAPSED_STRING or '(' in /in/kP4Wf on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_STRING, expecting T_CONSTANT_ENCAPSED_STRING or '(' in /in/kP4Wf on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_CONSTANT_ENCAPSED_STRING' or `'('' in /in/kP4Wf on line 3
Process exited with code 255.