note 28708 added to function.empty
| From: | Dan at rack1 dot php dot net | Date: | Tue, 21 Jan 2003 22:47:11 +0000 |
| Subject: | note 28708 added to function.empty | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-42549@lists.php.net to get a copy of this message | ||
As far as I can tell, the only useful purpose of empty() is to do this:
if (!$var) {
do_something();
}
without getting a NOTICE error. This code will return no errors with error_reporting(E_ALL):
if (empty($var)) {
do_something();
}
The isset() function is very helpful to find if a form field was submitted as blank. I could give
an example but I think somebody alreay did in here.
My point is that isset() and empty() are redundant but they do allow you to program in
error_reporting(E_ALL) without warnings or notices, which usually means more secure scripts...
--
http://www.php.net/manual/en/function.empty.php
http://master.php.net/manage/user-notes.php?action=edit+28708
http://master.php.net/manage/user-notes.php?action=delete+28708
http://master.php.net/manage/user-notes.php?action=reject+28708