3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php interface IX {} class X implements IX {} class Y {} function foo(IX $x, $y) {} $rf = new \ReflectionFunction('foo'); $rp = $rf->getParameters()[0]; $x = new X; var_dump($rp->getType(), $rp->getClass()->isInstance(0), $rf->getParameters()[1]->getClass());
based on OB90I
Output for 7.1.0 - 7.2.0
Warning: ReflectionClass::isInstance() expects parameter 1 to be object, integer given in /in/MvApR on line 13 object(ReflectionNamedType)#4 (0) { } NULL NULL
Output for 7.0.0 - 7.0.20
Warning: ReflectionClass::isInstance() expects parameter 1 to be object, integer given in /in/MvApR on line 13 object(ReflectionType)#4 (0) { } NULL NULL
Output for 5.4.11 - 5.6.28
Fatal error: Call to undefined method ReflectionParameter::getType() in /in/MvApR on line 13
Process exited with code 255.
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/MvApR on line 10
Process exited with code 255.