note 14578 added to function.is-subclass-of.php
| From: | php at nichtich dot de | Date: | Sat, 04 Aug 2001 21:47:35 +0000 |
| Subject: | note 14578 added to function.is-subclass-of.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-16319@lists.php.net to get a copy of this message | ||
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);
}
http://www.php.net/manual/en/function.is-subclass-of.php