3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Foo { public function load(string $file, array $data) {} } $reflection = new \ReflectionClass('Foo'); $method = $reflection->getMethod('load'); foreach ($method->getParameters() as $param) { var_dump($param); }
based on MtPeF
Output for 5.6.0 - 5.6.30, 7.0.0 - 7.2.6
object(ReflectionParameter)#3 (1) { ["name"]=> string(4) "file" } object(ReflectionParameter)#4 (1) { ["name"]=> string(4) "data" }
Output for hhvm-3.15.4
object(ReflectionParameter)#3 (3) { ["info"]=> array(10) { ["index"]=> int(0) ["name"]=> string(4) "file" ["type"]=> string(9) "HH\string" ["type_hint"]=> string(6) "string" ["type_hint_builtin"]=> bool(true) ["function"]=> string(4) "load" ["class"]=> string(3) "Foo" ["type_hint_nullable"]=> bool(false) ["attributes"]=> array(0) { } ["is_optional"]=> bool(false) } ["name"]=> string(4) "file" ["paramTypeInfo"]=> array(3) { ["name"]=> string(6) "string" ["nullable"]=> bool(false) ["builtin"]=> bool(true) } } object(ReflectionParameter)#4 (3) { ["info"]=> array(10) { ["index"]=> int(1) ["name"]=> string(4) "data" ["type"]=> string(5) "array" ["type_hint"]=> string(5) "array" ["type_hint_builtin"]=> bool(true) ["function"]=> string(4) "load" ["class"]=> string(3) "Foo" ["type_hint_nullable"]=> bool(false) ["attributes"]=> array(0) { } ["is_optional"]=> bool(false) } ["name"]=> string(4) "data" ["paramTypeInfo"]=> array(3) { ["name"]=> string(5) "array" ["nullable"]=> bool(false) ["builtin"]=> bool(true) } }