, AND and &&
I am know about priority, but if we have one simple condition:
if ($a == 1 AND $b == 2){
}
Is there any difference with
if ($a == 1 && $b == 2){
}
?
There is no difference at all, except that perhaps using AND
is somewhat more readable.
EDIT: just checked, and there is a small difference in the operators precedence, see http://php.net/manual/en/language.operators.precedence.php
They do the exact same thing. &&
has higher precedence that AND
though.
This has been asked before:
PHP - and / or keywords
PHP : Difference between '&&' and 'AND'
两者在php中都是一样的,但大多数程序员习惯于使用&&作为其在大多数编程语言中使用的语法
链接地址: http://www.djcxy.com/p/57636.html上一篇: 为什么(错误和错误或真实)返回true
下一篇: ,AND和&&