note 30583 added to function.empty
| From: | rmorrow dot NOSPAM at NOSPAM dot neospire dot net | Date: | Sun, 23 Mar 2003 02:23:49 +0000 |
| Subject: | note 30583 added to function.empty | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-45661@lists.php.net to get a copy of this message | ||
I found empty() useful at the beginning of user defined functions, in which I check to make sure any
necessary variables are present before going into any logic. This makes it easier for me to control
some errors.
function foo_bar($var1,$var2){
...if (empty($var1) or empty($var2)){
......echo "You must pass var1 and var2 to this function";
......exit();
...{
...<other logic>
}
Seems to do the job :-)
--
http://www.php.net/manual/en/function.empty.php
http://master.php.net/manage/user-notes.php?action=edit+30583
http://master.php.net/manage/user-notes.php?action=delete+30583
http://master.php.net/manage/user-notes.php?action=reject+30583