note 116519 deleted from function.isset by tularis
| From: | tularis@php.net | Date: | Sat, 17 Jan 2015 18:31:53 +0000 |
| Subject: | note 116519 deleted from function.isset by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-201445@lists.php.net to get a copy of this message | ||
Note Submitter: kazypac2009 at yahoo dot com
----
Am trying to create a 'generic is_set function' that i can pass any either a variable or
multi-variables or an array and will return true if what is passed to it is set and false if what is
passed to it false. This is what i came up with but.
function is_set () {
if(func_num_args() == 1 && is_array
(func_get_arg(0))){
$arr = func_get_arg(0);
$c = count($arr);
for($i = 0; $i < $c; $i++){
if (!isset($arr[$i]))
return false;
}
return true;
}
elseif(func_num_args() == 1 && !is_array
(func_get_arg(0))) {
$arg = func_get_arg(0);
return (isset($arg)) ? true : false;
}
else{
$args = func_get_args();
for($i = 0; $i < count($args); $i++){
if (!is_set($args[$i]))
return false;
}
return true;
}
}
pls email me for any correction. Thanks