note 91652 deleted from function.empty by danbrown
| From: | danbrown@php.net | Date: | Mon, 22 Jun 2009 12:50:31 +0000 |
| Subject: | note 91652 deleted from function.empty by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-157227@lists.php.net to get a copy of this message | ||
Note Submitter: mati_ at zenbe dot com
----
If you want an empty-check with dynamic number of parameters, like in isset():
function _empty() {
$status = false;
for($i = 0; $i < func_num_args(); $i++) {
$var = func_get_arg($i);
if (empty($var)) {
$status = true;
break;
}
}
return $status;
}
Example:
$var1='foo';
$var2='';
// $var2 is empty, therefore the function return true
if(!_empty($var1,$var2)) echo 'All fields filled';
else die('Fill every field!');