开发者

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 any advantage to using AND and OR over && and || in PHP?

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜