Similarities and differences between & amp; and & amp; in php logical operators: php has five arithmetic operators (& #43;-* %), with 6 operators assigned & #20540; operator (& amp; #43;-* % .), 8 Comparison operators (& lt; & gt ;! & Lt; & gt ;!), 6 logical operators (such as & amp;, |, & amp;, and php logical operators & and &)
Php has five arithmetic operators (+-*/%) and six value assignment operators (+ =-= * =/= % =. =), 8 comparison operators (==<><=>=! = <>! =), 6 types of logical operators (such as &, ||, &, | ,! . Here, the logic and & can be written as and, the logic or | can be written as or, and some other operators (error control operator @, execution operator anti-quotation marks "-- not single quotation marks, string operators. and. =, increment/decrease operator + +/--, three element operator? :).
For more information about operator priority, see related documents.
Similarities and differences between & and & in php
4 & (++ $ a> 10) {}// the output result is 11. echo $ a;?>
4 and (++ $ a> 10) {}// the output result is 11. echo $ a;?> **************************************** **********************
4 & (++ $ a <10) {}// the output result is 11. echo $ a;?>
4 & (++ $ a <10) {}// the output result is 11. echo $ a;?> **************************************** *****************
10) {}// the output result is 10. echo $ a;?>
10) {}// the output result is 11. echo $ a;?> **************************************** ***************************
**************************************** ***************************
Expression 1 $ a & $ B, expression 2 $ a & $ B
1. similarities: both expressions are true when both $ a and $ B are true. The two operators have no effect on the expression results.
2. Differences: if $ a in expression $ a & $ B and $ a before expression is false, the determined expression is false, in this case, the logical operator & $ B after is no longer computed, that is, the so-called operator "short circuit. For the expression $ a & $ B, the $ B after the expression is still calculated regardless of the true or false $ a before the expression. Whether $ B after the logical operator is run may affect subsequent data and program results.
For logical operators | and |, the similarities and differences are the same as above.