note 28456 added to function.is-null
| From: | minkyo at maru dot jp | Date: | Tue, 14 Jan 2003 03:09:01 +0000 |
| Subject: | note 28456 added to function.is-null | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-42093@lists.php.net to get a copy of this message | ||
One of the ways to distinguish 0 from null in " ":
Since I was using PHP version under 4, I couldn't use "===" nor "is_null."
So, in order to exclude 0 from " " ...
if (($var == "") && ($var != "0"))
{
echo "Only cases of null go through here.";
}
I forgot to add a double quotation around 0 in the if condition and it failed to catch only the
cases of null. After adding the double quotation, it worked, but I still don't understand why
it needed to be "0" instead of simply 0.
--
http://www.php.net/manual/en/function.is-null.php
http://master.php.net/manage/user-notes.php?action=edit+28456
http://master.php.net/manage/user-notes.php?action=delete+28456
http://master.php.net/manage/user-notes.php?action=reject+28456