note 98767 deleted from function.isset by googleguy
| From: | googleguy@php.net | Date: | Sat, 19 Jan 2013 03:54:36 +0000 |
| Subject: | note 98767 deleted from function.isset by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-193268@lists.php.net to get a copy of this message | ||
Note Submitter: Raphael Campos
----
Keep in mind that an empty string is not null, and an empty GET or POST field returns an empty
string instead of NULL, thus...
file.php?foo
<?php
$a = '';
$b = NULL;
isset($a); // => TRUE
isset($b); // => FALSE
(isset($a) && $a === ''); // => TRUE
?>
With that in mind, one probably would use isset() to check if a variable has been declared somehow
and it's value is not the special value NULL. If you want to check if the value is an empty
string, it's probably a better idea to check it literally:
<?php
(isset($a) && $a == '') // => TRUE
?>