3v4l.org

run code in 300+ PHP versions simultaneously
<?php use Other\Hierarchy\TheOtherNamespace; $a = function(\Some\Random\Namespace $b) { }; $b = function(TheOtherNamespace $c) { }; $handlers = [$a, $b]; foreach ($handlers as $handler) { $r = new ReflectionFunction($handler); $p = $r->getParameters(); var_dump($p[0]->getClass()); }
Output for 8.1.23 - 8.1.28, 8.2.10 - 8.2.18, 8.3.0 - 8.3.6
Deprecated: Method ReflectionParameter::getClass() is deprecated in /in/kIikN on line 19 Fatal error: Uncaught ReflectionException: Class "Some\Random\Namespace" does not exist in /in/kIikN:19 Stack trace: #0 /in/kIikN(19): ReflectionParameter->getClass() #1 {main} thrown in /in/kIikN on line 19
Process exited with code 255.
Output for 5.4.0 - 5.4.30
Parse error: syntax error, unexpected 'Namespace' (T_NAMESPACE), expecting identifier (T_STRING) in /in/kIikN on line 5
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_NAMESPACE, expecting T_STRING in /in/kIikN on line 5
Process exited with code 255.

preferences:
86.62 ms | 401 KiB | 87 Q