3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Foo { public function Bar($foo, $baz = null) {} } $refC = new ReflectionClass('Foo'); $refM = $refC->getMethod('Bar'); var_dump($refM->getParameters());
Output for 7.0.0 - 7.1.0
array(2) { [0]=> object(ReflectionParameter)#3 (1) { ["name"]=> string(3) "foo" } [1]=> object(ReflectionParameter)#4 (1) { ["name"]=> string(3) "baz" } }
Output for hhvm-3.12.0
array(2) { [0]=> object(ReflectionParameter)#3 (3) { ["info"]=> array(11) { ["index"]=> int(0) ["name"]=> string(3) "foo" ["type"]=> string(0) "" ["type_hint"]=> string(0) "" ["type_hint_builtin"]=> bool(false) ["function"]=> string(3) "Bar" ["class"]=> string(3) "Foo" ["nullable"]=> bool(true) ["type_hint_nullable"]=> bool(true) ["attributes"]=> array(0) { } ["is_optional"]=> bool(false) } ["name"]=> string(3) "foo" ["paramTypeInfo"]=> array(3) { ["name"]=> string(0) "" ["nullable"]=> bool(true) ["builtin"]=> bool(false) } } [1]=> object(ReflectionParameter)#4 (3) { ["info"]=> array(13) { ["index"]=> int(1) ["name"]=> string(3) "baz" ["type"]=> string(0) "" ["type_hint"]=> string(0) "" ["type_hint_builtin"]=> bool(false) ["function"]=> string(3) "Bar" ["class"]=> string(3) "Foo" ["nullable"]=> bool(true) ["type_hint_nullable"]=> bool(true) ["default"]=> NULL ["defaultText"]=> string(4) "NULL" ["attributes"]=> array(0) { } ["is_optional"]=> bool(true) } ["name"]=> string(3) "baz" ["paramTypeInfo"]=> array(3) { ["name"]=> string(0) "" ["nullable"]=> bool(true) ["builtin"]=> bool(false) } } }
Output for hhvm-3.10.0
array(2) { [0]=> object(ReflectionParameter)#3 (2) { ["info"]=> array(9) { ["index"]=> int(0) ["name"]=> string(3) "foo" ["type"]=> string(0) "" ["type_hint"]=> string(0) "" ["function"]=> string(3) "Bar" ["class"]=> string(3) "Foo" ["nullable"]=> bool(true) ["attributes"]=> array(0) { } ["is_optional"]=> bool(false) } ["name"]=> string(3) "foo" } [1]=> object(ReflectionParameter)#4 (2) { ["info"]=> array(11) { ["index"]=> int(1) ["name"]=> string(3) "baz" ["type"]=> string(0) "" ["type_hint"]=> string(0) "" ["function"]=> string(3) "Bar" ["class"]=> string(3) "Foo" ["nullable"]=> bool(true) ["default"]=> NULL ["defaultText"]=> string(4) "NULL" ["attributes"]=> array(0) { } ["is_optional"]=> bool(true) } ["name"]=> string(3) "baz" } }
Output for 5.0.0 - 5.6.28
array(2) { [0]=> &object(ReflectionParameter)#3 (1) { ["name"]=> string(3) "foo" } [1]=> &object(ReflectionParameter)#4 (1) { ["name"]=> string(3) "baz" } }
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/YcAug on line 4
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/YcAug on line 4
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/YcAug on line 4
Process exited with code 255.