Is there any advantage to using AND and OR over && and || in PHP?
In the Kohana code conventions it states that using &&
and ||
is "incorrect":
Is there a开发者_运维技巧ny advantage to using AND
and OR
other than clarity?
The truth tables for the operators are the same, the only difference is precedence:
http://php.net/manual/en/language.operators.logical.php
http://www.php.net/manual/en/language.operators.precedence.php
Just make sure that whatever convention you choose to adopt you are consistent throughout. Otherwise precedence issues will haunt your code.
精彩评论