PHP Operator Precedence
Combination Direction |
operator |
Additional Information |
Non-binding |
clone new |
Clone and New |
Left |
[ |
Array () |
Non-binding |
++ -- |
Increment/decrement operator |
Non-binding |
~ - (int) (float) (string) (array) (object) (bool) @ |
Type |
Non-binding |
instanceof |
Type |
Right combination |
! |
logical operators |
Left |
* / % |
Arithmetic operators |
Left |
+ - . |
Arithmetic operators and string operators |
Left |
<< >> |
Bitwise operators |
Non-binding |
< <= > >= <> |
Comparison operators |
Non-binding |
== != === !== |
Comparison operators |
Left |
& |
Bitwise operators and references |
Left |
^ |
Bitwise operators |
Left |
| |
Bitwise operators |
Left |
&& |
logical operators |
Left |
|| |
logical operators |
Left |
? : |
Ternary operators |
Right |
= += -= *= /= .= %= &= |= ^= <<= >>= |
Assignment operators |
Left |
and |
logical operators |
Left |
xor |
logical operators |
Left |
or |
logical operators |
Left |
, |
Used in many places |
PHP operator Precedence (excerpted from online Tools)