The following table lists the precedence of operators with the highest-precedence operators listed at the top of the table. Operators on the same line have equal precedence, in which case their associativity decides which order to evaluate them in.
Left associativity means that the expression is evaluated from left to right, right associativity means the opposite.
Associativity | Operators |
---|---|
non-associative | new |
left | [ |
non-associative | ++ -- |
non-associative | ! ~ - (int) (float) (string) (array) (object) @ |
left | * / % |
left | + - . |
left | << >> |
non-associative | < <= > >= |
non-associative | == != === !== |
left | & |
left | ^ |
left | | |
left | && |
left | || |
left | ?: |
right | = += -= *= /= .= %= &= |= ^= < <= > >= |
left | and |
left | xor |
left | or |
left | , |