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){
}
?
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:
The both work the same in php, but most programmers are used to using && as its the syntax used in most programming languages