note 28561 deleted from function.is-a by nlopess
| From: | nlopess@php.net | Date: | Fri, 09 Apr 2004 14:29:30 +0000 |
| Subject: | note 28561 deleted from function.is-a by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-67895@lists.php.net to get a copy of this message | ||
Note Submitter: robert.head@paizopublishing.com
----
If you may be using a version of php prior to 4.2.0, simply conditionally define is_a for yourself
as follows:
if (!function_exists('is_a')) {
function is_a( $object, $className ) {
return ((strtolower($className) == get_class($object))
or (is_subclass_of($object, $className)));
}
}
This is short and sweet and, as far as I can tell, exactly mimics the behavior of the built-in
function.