php - Undefined Index Error when using variable in if statement that is sometimes not set -
i use if statement $_get['av']
not set. when not set throws error. there way around this?
if ($admin == 1 , ($_get['av'] == "0" or !isset($_get['av'])))
yes, place second statement first.
if ($admin == 1 , (!isset($_get['av']) or $_get['av'] == "0"))
that way, if $_get['av']
isn't set, code never end referencing it, if-statement stopped @ isset
, block won't execute because of false return value.
also check out demorgan's law , how applies if statements. might clarify formatting of more complicated statements.
Comments
Post a Comment