Lecture 7 PHP Operator Precedence & Associativity
Lecture 7 PHP Operator Precedence & Associativity
COMP203TH
Lecture: 7
PHP Operator Precedence and Associativity
Right ** exponentiation
n/a ++ -- increment/decrement
n/a ! logical operator
left */ % arithmetic
left +-. arithmetic and string
left << >> bitwise
non-associative < <= > >== comparison
left & bitwise
left ^ bitwise
left | bitwise
left && logical
left || logical
left ?: ternary
right = += -= all assignment operators
left and logical
left xor logical
left or logical
Note: in the above table observe the precedence level of “and” and “or”,
“&&” and “||”.