note 36509 rejected from function.isset by vincent
| From: | vincent@php.net | Date: | Mon, 13 Oct 2003 08:39:30 +0000 |
| Subject: | note 36509 rejected from function.isset by vincent | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-58518@lists.php.net to get a copy of this message | ||
Note Submitter: phil@adigital.com.mx
----
unset($a);
print isset($a); // returns FALSE
$a = null
print isset($a); // returns FALSE ALSO !!
It seems to me that $a IS set even if it has a null VALUE.
unset($a);
print $a; // returns a HUGE NOT SET VARIABLE WARNING
$a = null;
print $a; // return ""
So 2 questions:
1. Is it a BUG ?
2. If not, HOW DO I KNOW IF THE VARIABLE "IS SET" and has a NULL value ?
I explain better:
$a = null;
if (!isset($a))
$a = "a";
if ($a === null)
$a = "other value";
seems that $a will NEVER get "other value" value. which is really annoying
Is there any other function that can say is $a is really set to null?
(please check "is_null" before answering somethin wrong:
$a = null;
unset($b);
print is_null($a); // gets true
print is_null($b); // gets true AND a freaky warning !
)
Thanks.