Re: wrong behaviour with is_subclass_of() ??
| From: | Stut | Date: | Fri, 19 Sep 2008 14:40:11 +0000 |
| Subject: | Re: wrong behaviour with is_subclass_of() ?? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-280504@lists.php.net to get a copy of this message | ||
On 19 Sep 2008, at 15:19, Johannes Müller wrote:
Why does the following code <?php interface I { public function a(); } class A implements I { public function a() {} } class B extends A { } if (is_subclass_of('A', 'I')) echo "A implements I\n"; if (is_subclass_of('B', 'I')) echo "B implements I\n"; ?> outputs: B implements I I would expect the following output: A implements I B implements IBecause there is a big difference between extends and implements, one of which being that the class is not considered to be a subclass of an interface it implements. Seems entirely logical to me. -Stut -- http://stut.net/