note 36509 added to function.isset

From: Date: Mon, 13 Oct 2003 07:32:52 +0000
Subject: note 36509 added to function.isset
Groups: php.notes 
Request: Send a blank email to php-notes+get-58515@lists.php.net to get a copy of this message
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. ---- Manual Page -- http://www.php.net/manual/en/function.isset.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+36509 Delete -- http://master.php.net/manage/user-notes.php?action=delete+36509&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+36509&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#58515) next »