Re: note 16297 added to ref.var

From: Date: Wed, 24 Oct 2001 04:20:27 +0000
Subject: Re: note 16297 added to ref.var
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-19360@lists.php.net to get a copy of this message
On October 23, 2001 10:00 pm, php@dynamicink.com wrote: > 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.) Hi! Thanks for the note - could you drop by bugs.php.net and submit a bug with the type General Issues -> Documentation Problem This way, the documentation team will get the message, and you can track the progress of the bug and supply additional feedback as it is being corrected. One minor note, your description of empty() is also faulty. A more accurate description would be something like: Test if a variable is declared and contains a non-empty, non-zero value. Empty values include: arrays with no elements objects with no properties NULL FALSE zero-length strings ("") strings containing a single zero (*0") -- --zak "We must be the change we wish to see." - M. K. Ghandi

« previous php.notes (#19360) next »