3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public function foo(PDO $foo = null, array $bar, int $x = 0) { } } $method = new ReflectionMethod(A::class, "foo"); $params = $method->getParameters(); foreach ($params as $param) { $type = $param->getType(); var_dump($type->isBuiltin(), $type->allowsNull(), (empty($type) ? "" : $type . " ") . $param->name); print PHP_EOL . PHP_EOL; }

preferences:
23.72 ms | 404 KiB | 5 Q