PHP: Operator Precedence

The following table lists the operators in order of precedence, with the highest-precedence ones at the top. Operators on the same line have equal precedence, in which case associativity decides grouping.

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] (http://php.net/manual/en/language.operators.increment.php)
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

你可能感兴趣的:(PHP: Operator Precedence)