isset can be used to check if multiple variables are ALL set:
if (isset($var1, $var2, $var3)) {...}
But what if I want to check if ANY of the variables are set?
if (isset($var1) || isset($var2) || isset($var3)) {...}
Given that using @ for error suppression is considered bad practice, is there a better way than this?
function orset()
{
foreach (func_get_args() as $arg) {
if (isset($arg)) return true;
}
return false;
}
if (orset(@$var1, @$var2, @$var3)) {...}