note 67135 added to function.empty
| From: | cypheratinboxdotlv at osu1 dot php dot net | Date: | Sat, 03 Jun 2006 19:41:09 +0000 |
| Subject: | note 67135 added to function.empty | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-113144@lists.php.net to get a copy of this message | ||
I have noticed the following:
Let's say you have such URL: http://yourhost.com/index.php?myvar=0
which means $_GET["myvar"] = 0;
If you check myvar in such a way:
if (empty($_GET["myvar"]))
// do something
then it will evaluate as TRUE! although the value is '0'.
In order to make such a check work you must use isset:
if (!isset($_GET["myvar"]))
// do something
This evaluetes to FALSE
----
Server IP: 217.199.126.93
Probable Submitter: 217.195.54.170
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.empty.php
Edit -- http://master.php.net/note/edit/67135
Del: integrated -- http://master.php.net/note/delete/67135/integrated
Del: useless -- http://master.php.net/note/delete/67135/useless
Del: bad code -- http://master.php.net/note/delete/67135/bad+code
Del: spam -- http://master.php.net/note/delete/67135/spam
Del: non-english -- http://master.php.net/note/delete/67135/non-english
Del: in docs -- http://master.php.net/note/delete/67135/in+docs
Del: other reasons-- http://master.php.net/note/delete/67135
Reject -- http://master.php.net/note/reject/67135
Search -- http://master.php.net/manage/user-notes.php