00001 <?php
00013 function typeId($var){
00014 if($classType = get_class($var))return $classType;
00015 return gettype($var);
00016 }
00024 function ofType($var, $typeName){
00025 return (strtolower(typeId($var)) == strtolower($typeName));
00026 }
00034 function ofPolymorphicType($var, $className){
00035 if($classType = get_class($var)){
00036 if($className == $classType)return true;
00037
00038 $parentClassList = array();
00039 $parentClassName = get_class($var);
00040 while($parentClassName = get_parent_class($parentClassName)){
00041 $parentClassList[] = strtolower($parentClassName);
00042 }
00043
00044 return in_array(strtolower($className), $parentClassList);
00045 }else{
00046 return (strtolower(typeId($var)) == strtolower($className));
00047 }
00048 }
00050 ?>