You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The coding guidelines suggest using `and` and `or` over `&&`
and `||`. Frankly I don't think this is a good idea. The
precedence rules for `and` and `or` are so weird, they will
cause lots of confusion and edge cases.
To illustrate this, look at the following example ([from logical
operators][0]):
$x = false or true;
What do you expect the value of `$x` to be? It's `false`, because
`or` has lower precedence than `=`. So while you expected the
expression to be:
$x = (false or true);
It is in fact:
($x = false) or true;
Stop using `and`/`or` as logical operators. They were designed
for flow control.
[0]: http://php.net/manual/en/language.operators.logical.php
0 commit comments