Reputation: 81
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:)
Upvotes: 3
Views: 21945
Reputation: 3729
||
means or.
It's a logical or, so it's true if at least one of the terms is true, false otherwise.
Upvotes: 1
Reputation: 2568
This is an OR operator. It is true if any of it's 'parameters' is true.
Upvotes: 1
Reputation: 76240
Googling symbols is always hard. Don't worry: ||
means or
in the statement. Don't confuse it for Xor
which is slightly different:
or
or ||
is meant as A or B or A + B
xor
is meant as A or B, not both
References:
Upvotes: 3
Reputation: 190943
It is the OR logicial operator.
http://www.php.net/manual/en/language.operators.logical.php
Upvotes: 4