note 19763 added to function.is-a
| From: | dan at php2 dot chek dot com | Date: | Sun, 10 Mar 2002 10:22:18 +0000 |
| Subject: | note 19763 added to function.is-a | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-27576@lists.php.net to get a copy of this message | ||
Sorry, two corrections to that function. My variables were not clear and I wasn't checking if
the class passed in was the same type as match (I was going straight to the parent)
if (!function_exists('is_a')) {
function is_a($class, $match)
{
if (empty($class)) {
return false;
}
$class = is_object($class) ? get_class($class) : $class;
if (strtolower($class) == strtolower($match)) {
return true;
}
return is_a(get_parent_class($class), $match);
}
}
--
http://www.php.net/manual/en/function.is-a.php
http://master.php.net/manage/user-notes.php?action=edit+19763
http://master.php.net/manage/user-notes.php?action=delete+19763
http://master.php.net/manage/user-notes.php?action=reject+19763