return (empty($neededRole) || strcasecmp($role, 'admin') == 0 || strcasecmp($role, $neededRole) == 0);
What exactly does the || mean in this statement? Can someone put this in english for me.
I promise I've googled this but I guess I don't know what to google for because I can't find anything.
thanks:)
4 Answers
It is the OR logicial operator.
Googling symbols is always hard. Don't worry: || means or in the statement. Don't confuse it for Xor which is slightly different:
oror||is meant asA or B or A + Bxoris meant asA or B, not both
References:
This is an OR operator. It is true if any of it's 'parameters' is true.
|| means or.
It's a logical or, so it's true if at least one of the terms is true, false otherwise.