3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function f(string $f){} $f = new ReflectionFunction('f'); $param = $f->getParameters(); var_dump($param[0]); var_dump(get_class($param[0])); var_dump(get_class_methods($param[0])); var_dump($param[0]->getTypeName());
based on cS6qM
Output for 7.0.0 - 7.1.0
object(ReflectionParameter)#2 (1) { ["name"]=> string(1) "f" } string(19) "ReflectionParameter" array(21) { [0]=> string(6) "export" [1]=> string(11) "__construct" [2]=> string(10) "__toString" [3]=> string(7) "getName" [4]=> string(19) "isPassedByReference" [5]=> string(18) "canBePassedByValue" [6]=> string(20) "getDeclaringFunction" [7]=> string(17) "getDeclaringClass" [8]=> string(8) "getClass" [9]=> string(7) "hasType" [10]=> string(7) "getType" [11]=> string(7) "isArray" [12]=> string(10) "isCallable" [13]=> string(10) "allowsNull" [14]=> string(11) "getPosition" [15]=> string(10) "isOptional" [16]=> string(23) "isDefaultValueAvailable" [17]=> string(15) "getDefaultValue" [18]=> string(22) "isDefaultValueConstant" [19]=> string(27) "getDefaultValueConstantName" [20]=> string(10) "isVariadic" } Fatal error: Uncaught Error: Call to undefined method ReflectionParameter::getTypeName() in /in/7CIMQ:11 Stack trace: #0 {main} thrown in /in/7CIMQ on line 11
Process exited with code 255.
Output for 5.6.7 - 5.6.28
object(ReflectionParameter)#2 (1) { ["name"]=> string(1) "f" } string(19) "ReflectionParameter" array(19) { [0]=> string(6) "export" [1]=> string(11) "__construct" [2]=> string(10) "__toString" [3]=> string(7) "getName" [4]=> string(19) "isPassedByReference" [5]=> string(18) "canBePassedByValue" [6]=> string(20) "getDeclaringFunction" [7]=> string(17) "getDeclaringClass" [8]=> string(8) "getClass" [9]=> string(7) "isArray" [10]=> string(10) "isCallable" [11]=> string(10) "allowsNull" [12]=> string(11) "getPosition" [13]=> string(10) "isOptional" [14]=> string(23) "isDefaultValueAvailable" [15]=> string(15) "getDefaultValue" [16]=> string(22) "isDefaultValueConstant" [17]=> string(27) "getDefaultValueConstantName" [18]=> string(10) "isVariadic" } Fatal error: Call to undefined method ReflectionParameter::getTypeName() in /in/7CIMQ on line 11
Process exited with code 255.
Output for 5.4.6 - 5.5.35
object(ReflectionParameter)#2 (1) { ["name"]=> string(1) "f" } string(19) "ReflectionParameter" array(18) { [0]=> string(6) "export" [1]=> string(11) "__construct" [2]=> string(10) "__toString" [3]=> string(7) "getName" [4]=> string(19) "isPassedByReference" [5]=> string(18) "canBePassedByValue" [6]=> string(20) "getDeclaringFunction" [7]=> string(17) "getDeclaringClass" [8]=> string(8) "getClass" [9]=> string(7) "isArray" [10]=> string(10) "isCallable" [11]=> string(10) "allowsNull" [12]=> string(11) "getPosition" [13]=> string(10) "isOptional" [14]=> string(23) "isDefaultValueAvailable" [15]=> string(15) "getDefaultValue" [16]=> string(22) "isDefaultValueConstant" [17]=> string(27) "getDefaultValueConstantName" } Fatal error: Call to undefined method ReflectionParameter::getTypeName() in /in/7CIMQ on line 11
Process exited with code 255.
Output for 5.4.0 - 5.4.5
object(ReflectionParameter)#2 (1) { ["name"]=> string(1) "f" } string(19) "ReflectionParameter" array(16) { [0]=> string(6) "export" [1]=> string(11) "__construct" [2]=> string(10) "__toString" [3]=> string(7) "getName" [4]=> string(19) "isPassedByReference" [5]=> string(18) "canBePassedByValue" [6]=> string(20) "getDeclaringFunction" [7]=> string(17) "getDeclaringClass" [8]=> string(8) "getClass" [9]=> string(7) "isArray" [10]=> string(10) "isCallable" [11]=> string(10) "allowsNull" [12]=> string(11) "getPosition" [13]=> string(10) "isOptional" [14]=> string(23) "isDefaultValueAvailable" [15]=> string(15) "getDefaultValue" } Fatal error: Call to undefined method ReflectionParameter::getTypeName() in /in/7CIMQ on line 11
Process exited with code 255.
Output for 5.2.3 - 5.3.29
object(ReflectionParameter)#2 (1) { ["name"]=> string(1) "f" } string(19) "ReflectionParameter" array(14) { [0]=> string(6) "export" [1]=> string(11) "__construct" [2]=> string(10) "__toString" [3]=> string(7) "getName" [4]=> string(19) "isPassedByReference" [5]=> string(20) "getDeclaringFunction" [6]=> string(17) "getDeclaringClass" [7]=> string(8) "getClass" [8]=> string(7) "isArray" [9]=> string(10) "allowsNull" [10]=> string(11) "getPosition" [11]=> string(10) "isOptional" [12]=> string(23) "isDefaultValueAvailable" [13]=> string(15) "getDefaultValue" } Fatal error: Call to undefined method ReflectionParameter::getTypeName() in /in/7CIMQ on line 11
Process exited with code 255.
Output for 5.1.3 - 5.2.2
object(ReflectionParameter)#2 (1) { ["name"]=> string(1) "f" } string(19) "ReflectionParameter" array(12) { [0]=> string(6) "export" [1]=> string(11) "__construct" [2]=> string(10) "__toString" [3]=> string(7) "getName" [4]=> string(19) "isPassedByReference" [5]=> string(17) "getDeclaringClass" [6]=> string(8) "getClass" [7]=> string(7) "isArray" [8]=> string(10) "allowsNull" [9]=> string(10) "isOptional" [10]=> string(23) "isDefaultValueAvailable" [11]=> string(15) "getDefaultValue" } Fatal error: Call to undefined method ReflectionParameter::getTypeName() in /in/7CIMQ on line 11
Process exited with code 255.
Output for 5.1.0 - 5.1.2
object(ReflectionParameter)#2 (1) { ["name"]=> string(1) "f" } string(19) "ReflectionParameter" array(11) { [0]=> string(6) "export" [1]=> string(11) "__construct" [2]=> string(10) "__toString" [3]=> string(7) "getName" [4]=> string(19) "isPassedByReference" [5]=> string(8) "getClass" [6]=> string(7) "isArray" [7]=> string(10) "allowsNull" [8]=> string(10) "isOptional" [9]=> string(23) "isDefaultValueAvailable" [10]=> string(15) "getDefaultValue" } Fatal error: Call to undefined method ReflectionParameter::getTypeName() in /in/7CIMQ on line 11
Process exited with code 255.
Output for 5.0.3 - 5.0.5
object(ReflectionParameter)#2 (1) { ["name"]=> string(1) "f" } string(19) "ReflectionParameter" array(10) { [0]=> string(6) "export" [1]=> string(11) "__construct" [2]=> string(10) "__toString" [3]=> string(7) "getName" [4]=> string(19) "isPassedByReference" [5]=> string(8) "getClass" [6]=> string(10) "allowsNull" [7]=> string(10) "isOptional" [8]=> string(23) "isDefaultValueAvailable" [9]=> string(15) "getDefaultValue" } Fatal error: Call to undefined method ReflectionParameter::getTypeName() in /in/7CIMQ on line 11
Process exited with code 255.
Output for 5.0.0 - 5.0.2
object(ReflectionParameter)#2 (1) { ["name"]=> string(1) "f" } string(19) "ReflectionParameter" array(8) { [0]=> string(7) "__clone" [1]=> string(6) "export" [2]=> string(11) "__construct" [3]=> string(10) "__toString" [4]=> string(7) "getName" [5]=> string(19) "isPassedByReference" [6]=> string(8) "getClass" [7]=> string(10) "allowsNull" } Fatal error: Call to undefined method ReflectionParameter::getTypeName() in /in/7CIMQ on line 11
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting ')' in /in/7CIMQ 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 ')' in /in/7CIMQ on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `')'' in /in/7CIMQ on line 3
Process exited with code 255.