3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php interface I { } class A implements I { } class B extends A { } $b = new B(); echo "B <-> I:\n"; var_dump($b instanceof I); var_dump(is_a($b, "I")); var_dump(is_subclass_of($b, "I")); $rc = new ReflectionClass("B"); var_dump($rc->getInterfaceNames()); echo "\n\nB <-> A:\n"; var_dump($b instanceof A); var_dump(is_a($b, "A")); var_dump(is_subclass_of($b, "A"));
Output for 5.6.0 - 5.6.30, hhvm-3.15.4, 7.0.0 - 7.3.0rc4
B <-> I: bool(true) bool(true) bool(true) array(1) { [0]=> string(1) "I" } B <-> A: bool(true) bool(true) bool(true)