如何检查是否设置了任何变量?

checking if all are set

if(
    isset($var1) &&
    isset($var2) &&
    isset($var3)
){}

can be re-written as

if(isset($var1,$var2,$var3)){}

but what's the syntax for if any are set?

if(
    isset($var1) ||
    isset($var2) ||
    isset($var3)
){}

Looks ugly; is there any better way to write this?

You have to pass strings instead of the variables, but for fun:

if(compact('var1', 'var2', 'var3')) {
    echo 'one or more is set';
} else {
    echo 'none are set';
}

I guess one could write a simple function to use, but there's probably a cleaner way.

function anyset(...$vars){
    foreach($vars as $var){
        if(isset($var)){
            return true;
        }
    }
    return false;
}

if(anyset($var1,$var2,$var3)){}