3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace MyNamespace; class MyClass { function foo(iterable $iterable, array $array, int $int) { } } $reflection = new \ReflectionMethod(MyClass::class, 'foo'); $parameters = $reflection->getParameters(); echo (string) $parameters[0]->getType(), PHP_EOL; echo (string) $parameters[1]->getType(), PHP_EOL; echo (string) $parameters[2]->getType(), PHP_EOL;
Output for 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
iterable array int
Output for 7.4.0 - 7.4.33
Deprecated: Function ReflectionType::__toString() is deprecated in /in/quhbu on line 13 iterable Deprecated: Function ReflectionType::__toString() is deprecated in /in/quhbu on line 14 array Deprecated: Function ReflectionType::__toString() is deprecated in /in/quhbu on line 15 int
Output for 7.0.0 - 7.0.33
MyNamespace\iterable array int
Output for 5.6.38
Fatal error: Call to undefined method ReflectionParameter::getType() in /in/quhbu on line 13
Process exited with code 255.

preferences:
179.24 ms | 401 KiB | 212 Q