Appendix C. Operators
Precedence | Operator | Operation It Performs | Associativity |
---|---|---|---|
1 | ! | logical not | Right |
~ | bitwise not | ||
++ | Increment | ||
-- | decrement | ||
@ | silence operator | ||
(int) | integer cast | ||
(float) | floating-point cast | ||
(string) | string cast | ||
(bool) | boolean cast | ||
(array) | array cast | ||
(object) | object cast | ||
2 | * | multiply | Left |
/ | divide | ||
% | modulo | ||
3 | + | add | Left |
– | subtract | ||
. | concatenate | ||
4 | << | bitwise shift left | Left |
>> | bitwise shift right | ||
5 | < | is smaller | Nonassociative |
<= | is smaller or equal | ||
> | is greater | ||
>= | is greater or equal | ||
6 | == | is equal | Nonassociative |
!= | is not equal | ||
=== | is identical | ||
!== | is not identical | ||
7 | && | logical and | Left |
8 | || | logical or | Left |
9 | ? : | question mark operator | Left |
10 | = | assign | Right |
=& | assign by reference | ||
+= | assign add | ||
-= | assign subtract | ||
*= | assign multiply | ||
/= | assign divide | ||
%= | assign modulo | ||
^= | assign ... |
Get Core PHP Programming, Third Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.