2
votes
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
-1 You should really review some programming basics. You won't code anything good in PHP if you even ignore the very basics of programming :( I'm very sorry to tell you this.gd1

4 Answers

2
votes

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:

0
votes

This is an OR operator. It is true if any of it's 'parameters' is true.

0
votes

|| means or. It's a logical or, so it's true if at least one of the terms is true, false otherwise.