xref: /PHP-5.6/Zend/tests/instanceof_002.phpt (revision e4c76641)
1--TEST--
2Testing instanceof operator with class and interface inheriteds
3--FILE--
4<?php
5
6interface ITest {
7}
8
9interface IFoo extends ITest {
10}
11
12class foo extends stdClass implements ITest {
13}
14
15var_dump(new foo instanceof stdClass);
16var_dump(new foo instanceof ITest);
17var_dump(new foo instanceof IFoo);
18
19class bar extends foo implements IFoo {
20}
21
22var_dump(new bar instanceof stdClass);
23var_dump(new bar instanceof ITest);
24var_dump(new bar instanceof IFoo);
25
26?>
27--EXPECT--
28bool(true)
29bool(true)
30bool(false)
31bool(true)
32bool(true)
33bool(true)
34