I was wondering if there are any disadvantages of using words (e.g.
OR) instead of their code equivalents (
||) for comparison? Besides the later being a compatible syntax with many other programming languages, is there any other reason for choosing them?
AND is not the same like &&
is not the same like
the first thing is (a and b) or c
the second a and (b or c)
because || has got a higher priority than and, but less than &&
They do the same thing, but the
Basically I think this can become confusing so if you just stick to one notation and not mix them, you'll be fine and your code will remain readable.
The PHP manual (in Logical Operators) talks about what you ask in your question:
So the difference is in the precedence, not the logical meaning of each single operator.
In your example:
An unanticipated disadvantage comes when used with the