note 28561 added to function.is-a

From: Date: Thu, 16 Jan 2003 22:29:26 +0000
Subject: note 28561 added to function.is-a
Groups: php.notes 
Request: Send a blank email to php-notes+get-42241@lists.php.net to get a copy of this message
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. -- http://www.php.net/manual/en/function.is-a.php http://master.php.net/manage/user-notes.php?action=edit+28561 http://master.php.net/manage/user-notes.php?action=delete+28561 http://master.php.net/manage/user-notes.php?action=reject+28561

« previous php.notes (#42241) next »