Operator priority-PHP operator priority
|
Operator priority-PHP operator priority. For more information, see.
| PHP operator priority |
| Integration direction |
Operator |
Additional information |
| Non-integration |
Clone new |
Clone and new |
| Left |
[ |
Array () |
| Non-integration |
++ -- |
Increment/decrease operator |
| Non-integration |
~ -(Int) (float) (string) (array) (object) (bool )@ |
Type |
| Non-integration |
Instanceof |
Type |
| Right Combination |
! |
Logical operators |
| Left |
*/% |
Arithmetic operators |
| Left |
+ -. |
Arithmetic operators and string operators |
| Left |
<> |
Bitwise operators |
| Non-integration |
<<=>>= <> |
Comparison Operators |
| Non-integration |
=! ===! = |
Comparison Operators |
| Left |
& |
Bitwise operators and references |
| Left |
^ |
Bitwise operators |
| Left |
| |
Bitwise operators |
| Left |
&& |
Logical operators |
| Left |
| |
Logical operators |
| Left |
? : |
Ternary operators |
| Right |
= + =-= * =/=. = % = & = | = ^ = <=> = |
Value assignment operator |
| Left |
And |
Logical operators |
| Left |
Xor |
Logical operators |
| Left |
Or |
Logical operators |
| Left |
, |
Multiple application scenarios |
| This table provides the operator priority (from low to high) for Python ). |
| From the lowest priority (the loose combination) to the highest priority (the strictest combination ). |
| This means that in an expression, Python will first calculate the following operators in the table, and then calculate the operators listed in the upper part of the table. |
|
Operator