# Operators, precedence, and their associativity : Operator Precedence « Operator « PHP

Operators, precedence, and their associativity

```
Operators                                                        Associativity

,             Left                                               "\$x, \$y, \$z" is "(\$x, \$y), \$z"

or            Left                                               "\$x OR \$y OR \$z" is "(\$x OR \$y) OR \$z"

xor           left                                               "x XOR y XOR z" is "(\$x XOR \$y) XOR \$z"

and           Left                                               "x AND y AND z" is "(x AND y) AND z"

= += -= * = /= .= %= &= |= ^= <<= gt;>=           Right          "\$x /= \$y /= \$z" is "\$x /= (\$y /= \$z)"

? :           Left
||            Left                                               "\$x || \$y || \$z" is "(\$x || \$y) || \$z"

&&            Left                                               "\$x && \$y && \$z" is "(\$x && \$y) && \$z"

|             Left                                               "\$x | \$y | \$z" is "(\$x | \$y) | \$z"

^             Left                                               "\$x ^ \$y ^ \$z" is "(\$x ^ \$y) ^ \$z"

&             Left                                               "\$x & \$y & \$z" is "(\$x & \$y) & \$z"

== != === !==                Non-associative

< < = > >=                    Non-associative

<< >>          Left                                               "\$x >> \$y >> \$z" is "(\$x >> \$y) >> \$z"

+ - .          Left                                               "\$x - \$y - \$z" is "(\$x - \$y) - \$z"

* / %          Left                                               "\$x / \$y / \$z" is "(\$x / \$y) / \$z"

! ~ ++ -- (int) (float) (string)(array) (object) @     Right

[              Right
new            Non-associative

```

### Related examples in the same category

 1 Operator Precedence 2 Operator Precedence summary table 3 Using the ? Operator 4 Using the ? operator to create a message