PHP Operators

PHP language supports following type of operators.

  • Arithmetic Operators
  • Assignment Operators
  • Bitwise Operators
  • Comparison Operators
  • Incrementing/Decrementing Operators
  • Logical Operators
  • String Operators
  • Array Operators
Operator Precedence
Associativity Operators Additional Information
non-associative clone new clone and new
left [ array()
right ** arithmetic
right ++ -- ~ (int) (float) (string) (array) (object) (bool) @ types and increment/decrement
non-associative instanceof types
right ! logical
left * / % arithmetic
left + - . arithmetic and string
left << >> bitwise
non-associative < <= > >= comparison
non-associative == != === !== <> <=> comparison
left & bitwise and references
left ^ bitwise
left | bitwise
left && logical
left || logical
right ?? comparison
left ? : ternary
right = += -= *= **= /= .= %= &= |= ^= <<= >>= assignment
left and logical
left xor logical
left or logical