note 16297 deleted from ref.var by zak

From: Date: Wed, 24 Oct 2001 04:08:24 +0000
Subject: note 16297 deleted from ref.var by zak
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-19359@lists.php.net to get a copy of this message
The definitions above are pretty poor: empty -- Determine whether a variable is set isset -- Determine whether a variable is set The actual definitions are: empty - returns true if the variable has been declared AND HOLDS A NULL VALUE. isset - returns true if the variable has been declared, regardless of it's value. This can be done many ways for instance: by setting a value (PHP is a loosly typed language afterall,) defining it as a session variable or appending it to the query string. example: if (isset($mom)) { echo "\$mom has been declared a variable"; if (empty($mom)) { echo "\mom does not hold any value though"; } } If you did not check with isset before using empty and the variable was not declared (!isset) you would get a 'mom is undefined' error when you call the empty function (unless you used error supression.)

« previous php.notes (#19359) next »