note 14578 deleted from function.is-subclass-of by nlopess
| From: | nlopess@php.net | Date: | Wed, 27 Oct 2004 13:59:38 +0000 |
| Subject: | note 14578 deleted from function.is-subclass-of by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-79177@lists.php.net to get a copy of this message | ||
Note Submitter: php at nichtich dot de
----
unfortunately is_subclass_of does not accept class names in both arguments like get_parent_class
since 4.0.5. Up do this use the following function:
function is_subclass($child, $parent) {
if(is_string($child)) {
do {
$child = get_parent_class($child);
if(!$child) return false;
} while ($child==$parent);
return true;
} else
return is_subclass_of($child, $parent);
}