i got this pice of code out of a script and i’m just wondering if someone can tell me what this line of code does. i think i kinda got an idea…
(isset($argv[1]) - checks if argv[1] is set
the ? i’m not sure except maybe it’s checking if argv[1] is = to safe
the rest of the line im not sure what it’s setting ? true : false) : false);
here is the full line of code…
$safeMode = (isset($argv[1]) ? ($argv[1] == "safe" ? true : false) : false);
can someone explain plz what it does
Thanks Snoop
i did some searching the ? is the conditional operator
$x ? $y : $z
would means "if $x
is true, then use $x
; otherwise use $z
".
so now i understand it a little bit more
$safeMode = (isset($argv[1]) ? ($argv[1] == "safe" ? true : false) : false);
so if argv[1] is set its true so use safe - now i don’t quite understand the ending ? true : false) : false); i’m still looking lol…
thanks Snoop