PHP Wysardry
PHP Manual

PHP documentation.



Home / PHP / Manual / ...



PHP Manual
Prev Chapter 10. Operators Next

Operator Precedence

The precedence of an operator specifies how "tightly" it binds two expressions together. For example, in the expression 1 + 5 * 3, the answer is 16 and not 18 because the multiplication ("*") operator has a higher precedence than the addition ("+") operator. Parentheses may be used to force precedence, if necessary. For instance: (1 + 5) * 3 evaluates to 18.

The following table lists the precedence of operators with the lowest-precedence operators listed first.

Table 10-6. Operator Precedence

Associativity Operators
left ,
left or
left xor
left and
right print
left = += -= *= /= .= %= ∓= |= ^= ~= <<= >>=
left ? :
left ||
left ∓∓
left |
left ^
left
non-associative == != === !==
non-associative < <= > >=
left << >>
left + - .
left * / %
right ! ~ ++ -- (int) (double) (string) (array) (object) @
right [
non-associative new

Prev Manual Home Next
Logical Operators Up String Operators
Site Menu

Amazon.ca
Amazon.com
Amazon.co.uk



Most recently updated on 11 May, 2003

Home / PHP / Manual / ...



Please feel free to contact us with any comments or suggestions
PHP Manual
PHP Wysardry

This site is hosted by Spaceports