Summary of the differences between or and | AND & amp; in php. There is no difference in itself, habits, but sometimes it involves the operator priority problem, the results will be different, record. For example, the copy code is as follows: $ p6or0; var_dump itself is no different. it is a habit, but sometimes it involves the operator priority problem. The results will be different and recorded.
For example:
The code is as follows:
$ P = 6 or 0;
Var_dump ($ p); // int (6)
$ P = 6 | 0;
Var_dump ($ p); // bool (true)
$ P = 6 and 0;
Var_dump ($ p); // int (6)
$ P = 6 & 0;
Var_dump ($ p); // bool (false)
Because the value assignment has a higher priority than and or, the value is assigned first. The value assignment is lower than the value & |. Therefore, the logical operators are executed first, the logical operations are performed first, AND then the values are assigned.
Operator. For example, the code is as follows: $ p = 6 or 0; var_dump...