note 26691 added to function.empty
| From: | davidmcarthur at mail dot com | Date: | Sat, 09 Nov 2002 01:27:14 +0000 |
| Subject: | note 26691 added to function.empty | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-39208@lists.php.net to get a copy of this message | ||
empty($var) is a shorthand for
((isset($var) and $var == FALSE) or !isset($var))
[note there is type casting going on with the ==]
which is something that I do *very* frequently as I pass around strings of HTML and arrays full of
data and do various things if the string or array "has something in it". Since I often
don't know whether a variable is going to be defined yet, this would be a big pain without
empty().
--
http://www.php.net/manual/en/function.empty.php
http://master.php.net/manage/user-notes.php?action=edit+26691
http://master.php.net/manage/user-notes.php?action=delete+26691
http://master.php.net/manage/user-notes.php?action=reject+26691