For
$a < $b | | $c = = $d && $e < $f
Is it possible to understand this:
$a < $b | | $c = = $d;
While
$c = = $d && $e < $f;
And
$a < $b have no logical relationship with $e < $f?
Is the priority of other languages so used?
Reply content:
For
$a < $b | | $c = = $d && $e < $f
Is it possible to understand this:
$a < $b | | $c = = $d;
While
$c = = $d && $e < $f;
And
$a < $b have no logical relationship with $e < $f?
Is the priority of other languages so used?
$a < $b | | ($c = = $d && $e < $f)
&& priority is higher than | | 。
Lou Zhu do not drill this corner. In team development, this is not Xu Yun written.
Three logical operators from high to Low: not and OR
First of all, this type of writing is not recommended during development, and will generally be killed.
1. This expression has comparison operators and logical operators, where logical operators && and logical operators | |.
For PHP, comparison operators have precedence over logical operators && and | |, but logical operators && precedence over logical operators | |
$a < $b | | $c = = $d && $e < $f
So the result of the operation is this: the first step is the operator comparison: ($a < $b) | | ($c = = $d) && ($e < $f)
Comparison of operators after comparison | | or &&
if ($a < $b) is true, the result of this expression is true
if: ($a < $b) is Fasle and ($c = = $d) and ($e < $f) One of them is fasle, the result is false.
This is a tall man ... I never study this kind of problem, it's very troublesome.
(($a < $b) || ($c == $d)) && ($e < $f)
Isn't that good?
Do you promise not to read this code again? Don't you need to think when you look at yourself? Then why do you make trouble for yourself?