instanceof_002.phpt 539 B

123456789101112131415161718192021222324252627282930313233
  1. --TEST--
  2. Testing instanceof operator with class and interface inheriteds
  3. --FILE--
  4. <?php
  5. interface ITest {
  6. }
  7. interface IFoo extends ITest {
  8. }
  9. class foo extends stdClass implements ITest {
  10. }
  11. var_dump(new foo instanceof stdClass);
  12. var_dump(new foo instanceof ITest);
  13. var_dump(new foo instanceof IFoo);
  14. class bar extends foo implements IFoo {
  15. }
  16. var_dump(new bar instanceof stdClass);
  17. var_dump(new bar instanceof ITest);
  18. var_dump(new bar instanceof IFoo);
  19. ?>
  20. --EXPECT--
  21. bool(true)
  22. bool(true)
  23. bool(false)
  24. bool(true)
  25. bool(true)
  26. bool(true)