note 52605 deleted from function.get-resource-type by nlopess
| From: | nlopess@php.net | Date: | Sat, 07 May 2005 07:31:15 +0000 |
| Subject: | note 52605 deleted from function.get-resource-type by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-89057@lists.php.net to get a copy of this message | ||
Note Submitter: docey
Reason: useless
----
its a good practise to first check that the variable is a
resource before checking what type of resource.
like this.
function get_type($resource, $type_wanted)
{
if(is_resource($resource)){
$type = get_resource_type($resource);
if($type == $type_wanted){
return true;
}else{
return false;
}
}else{
return false;
}
}
with this function you can check you have the right
resource before using it.