3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class X {} function foo(...$args) { foreach ($args as $v) { $t = gettype($v); if ($t === 'object') { $c = get_class($v); echo "$t:$c\n"; } else { echo "$t\n"; } } $f = function(X $x, string $y, int $z) {}; $ref_func = new ReflectionFunction($f); $ref_params = $ref_func->getParameters(); foreach ($ref_params as $p) { echo "{$p->getType()}\n"; } } foo(42, "hello", new X(), 1.2e3);
based on WDJ1O
Output for hhvm-3.15.4, 7.0.0 - 7.3.0alpha1
integer string object:X double X string int
Output for 5.6.0 - 5.6.30
integer string object:X double Fatal error: Call to undefined method ReflectionParameter::getType() in /in/Ve1B9 on line 21
Process exited with code 255.