php - Checking Multiple $_GET variables if equals a string -
if(isset($_get['a']) || isset($_get['b']) || isset($_get['c'])){ if(($_get['a'] || $_get['b'] || $_get['c']) == "x"){ echo "yes"; } else { echo "no"; } }
in php code, i'm trying check if 1 of requests isset
, if 1 of them value == 'x'
or not, 2nd part if(($_get['a'] || $_get['b'] || $_get['c']) == "x")
doesn't work intended @ all, wrapped inside ()
hoping work, in condition, have separate did inthe isset()
part? or there better method that?
this looking
update - changed ||
&&
last condition in case quick try out.
if( (isset($_get['a']) && $_get['a'] == "x") || (isset($_get['b']) && $_get['b'] == "x") || (isset($_get['c']) && $_get['c'] == "x")){ echo "yes"; } else { echo "no"; }
Comments
Post a Comment