1--TEST-- 2ZE2 An interface is inherited 3--SKIPIF-- 4<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> 5--FILE-- 6<?php 7 8interface if_a { 9 function f_a(); 10} 11 12interface if_b extends if_a { 13 function f_b(); 14} 15 16class base { 17 function _is_a($sub) { 18 echo 'is_a('.get_class($this).', '.$sub.') = '.(($this instanceof $sub) ? 'yes' : 'no')."\n"; 19 } 20 function test() { 21 echo $this->_is_a('base'); 22 echo $this->_is_a('derived_a'); 23 echo $this->_is_a('derived_b'); 24 echo $this->_is_a('derived_c'); 25 echo $this->_is_a('derived_d'); 26 echo $this->_is_a('if_a'); 27 echo $this->_is_a('if_b'); 28 echo "\n"; 29 } 30} 31 32class derived_a extends base implements if_a { 33 function f_a() {} 34} 35 36class derived_b extends base implements if_a, if_b { 37 function f_a() {} 38 function f_b() {} 39} 40 41class derived_c extends derived_a implements if_b { 42 function f_b() {} 43} 44 45class derived_d extends derived_c { 46} 47 48$t = new base(); 49$t->test(); 50 51$t = new derived_a(); 52$t->test(); 53 54$t = new derived_b(); 55$t->test(); 56 57$t = new derived_c(); 58$t->test(); 59 60$t = new derived_d(); 61$t->test(); 62 63?> 64--EXPECTF-- 65is_a(base, base) = yes 66is_a(base, derived_a) = no 67is_a(base, derived_b) = no 68is_a(base, derived_c) = no 69is_a(base, derived_d) = no 70is_a(base, if_a) = no 71is_a(base, if_b) = no 72 73is_a(derived_a, base) = yes 74is_a(derived_a, derived_a) = yes 75is_a(derived_a, derived_b) = no 76is_a(derived_a, derived_c) = no 77is_a(derived_a, derived_d) = no 78is_a(derived_a, if_a) = yes 79is_a(derived_a, if_b) = no 80 81is_a(derived_b, base) = yes 82is_a(derived_b, derived_a) = no 83is_a(derived_b, derived_b) = yes 84is_a(derived_b, derived_c) = no 85is_a(derived_b, derived_d) = no 86is_a(derived_b, if_a) = yes 87is_a(derived_b, if_b) = yes 88 89is_a(derived_c, base) = yes 90is_a(derived_c, derived_a) = yes 91is_a(derived_c, derived_b) = no 92is_a(derived_c, derived_c) = yes 93is_a(derived_c, derived_d) = no 94is_a(derived_c, if_a) = yes 95is_a(derived_c, if_b) = yes 96 97is_a(derived_d, base) = yes 98is_a(derived_d, derived_a) = yes 99is_a(derived_d, derived_b) = no 100is_a(derived_d, derived_c) = yes 101is_a(derived_d, derived_d) = yes 102is_a(derived_d, if_a) = yes 103is_a(derived_d, if_b) = yes 104