3v4l.org

run code in 300+ PHP versions simultaneously
<?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());
Output for git.master, git.master_jit, rfc.property-hooks
object(ReflectionParameter)#2 (1) { ["name"]=> string(1) "f" } string(19) "ReflectionParameter" array(22) { [0]=> string(11) "__construct" [1]=> string(10) "__toString" [2]=> string(7) "getName" [3]=> string(19) "isPassedByReference" [4]=> string(18) "canBePassedByValue" [5]=> string(20) "getDeclaringFunction" [6]=> string(17) "getDeclaringClass" [7]=> string(8) "getClass" [8]=> string(7) "hasType" [9]=> string(7) "getType" [10]=> string(7) "isArray" [11]=> string(10) "isCallable" [12]=> string(10) "allowsNull" [13]=> string(11) "getPosition" [14]=> string(10) "isOptional" [15]=> string(23) "isDefaultValueAvailable" [16]=> string(15) "getDefaultValue" [17]=> string(22) "isDefaultValueConstant" [18]=> string(27) "getDefaultValueConstantName" [19]=> string(10) "isVariadic" [20]=> string(10) "isPromoted" [21]=> string(13) "getAttributes" } 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.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
43.1 ms | 402 KiB | 8 Q