note 54329 added to function.empty
| From: | nsetzer at allspammustdie dot physics dot umd dot edu | Date: | Thu, 30 Jun 2005 15:02:44 +0000 |
| Subject: | note 54329 added to function.empty | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-91211@lists.php.net to get a copy of this message | ||
I needed to know if the variable was empty, but allow for it to be zero, so I created this function.
I post it here in case anybody else needs to do that (it's not hard to make, but why reinvent
the wheel...)
<?php
function is_extant($var)
{
if (isset($var))
{
if ( empty($var) && ($var !== 0) && ($var !== '0') )
return FALSE;
else
return TRUE;
}
else
return FALSE;
}
?>
----
Manual Page -- http://www.php.net/manual/en/function.empty.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+54329
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+54329&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+54329&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+54329&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+54329&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+54329&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+54329&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+54329&report=yes
Search -- http://master.php.net/manage/user-notes.php