note 19763 modified in function.is-a by didou

From: Date: Thu, 03 Jul 2003 14:18:05 +0000
Subject: note 19763 modified in function.is-a by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-51448@lists.php.net to get a copy of this message
php implementation to keep us happy for now 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); } } --was-- 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

« previous php.notes (#51448) next »