note 52605 added to function.get-resource-type
| From: | docey at osu1 dot php dot net | Date: | Fri, 06 May 2005 20:33:01 +0000 |
| Subject: | note 52605 added to function.get-resource-type | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-89035@lists.php.net to get a copy of this message | ||
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.
----
Manual Page -- http://www.php.net/manual/en/function.get-resource-type.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+52605
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+52605&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+52605&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+52605&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+52605&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+52605&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+52605&report=yes
Search -- http://master.php.net/manage/user-notes.php