What exactly does
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:)
It is the OR logicial operator.
http://www.php.net/manual/en/language.operators.logical.php
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:
This is an OR operator. It is true if any of it's 'parameters' is true.
链接地址: http://www.djcxy.com/p/1816.html上一篇: PHP中的or运算符的行为
下一篇: 究竟是什么