diff --git a/P%23-v1.0-Specification.md b/P%23-v1.0-Specification.md index 7262b0f..d75d028 100644 --- a/P%23-v1.0-Specification.md +++ b/P%23-v1.0-Specification.md @@ -288,29 +288,29 @@ The order of evaluation of operators in an expression is determined by the prece ### 6.1. Operator Precedence When an expression contains multiple operators, the precedence of the operators controls the order in which the individual operators are evaluated. The precedence of an operator is established by the definition of its associated grammar production. The following list shows common PHP operators ordered by precedence (highest precedence first): -| Description | Operator | Associativity | -|---------------------|-------------|---------------| -| increment/decrement | ++ -- | left | - - - * increment/decrement (++ --) - * casting - * logical "not" (!) - * bitwise "not" (~) - * arithmetic (* / %) - * arithmetic and string (+ -) - * bitwise (<< >>) - * comparison (< <= > >= <>) - * comparison (== != === !==) - * bitwise "and" (&) - * bitwise "xor" (^) - * bitwise "or" (|) - * logical "and" (&&) - * logical "xor" (^^) - * logical "or" (||) - * ternary operator (? :) - * assignment (= += -= *= /= .= %=) - * comma operator (,) +| Precedence | Description | Operator | Associativity | +|------------|-----------------------|------------------|-------------------| +| 1 | object-related | clone new | non-associative | +| 2 | postfix operators | -> :: [ | left-associative | +| 3 | increment / decrement | ++ -- | non-associative | +| 4 | unary operators | - + ~ ! @ | right-associative | +| 4 | cast operators | (typedef) | right-associative | +| 7 | binary operators | instanceof | non-associative | +| 7 | arithmetic operators | * / % | left-associative | +| 8 | arithmetic operators | + - | left-associative | +| 9 | bitwise operators | << >> | left-associative | +| 10 | comparison | < <= > >= | non-associative | +| 11 | comparison | == != === !== | non-associative | +| 12 | bitwise and | & | left-associative | +| 12 | reference operator | =& | left-associative | +| 13 | bitwise xor | ^ | left-associative | +| 14 | bitwise or | \| | left-associative | +| 15 | logical and | && | left-associative | +| 16 | logical xor | ^^ | left-associative | +| 17 | logical or | \|\| | left-associative | +| 18 | ternary operator | ? | left-associative | +| 19 | assignment operators | = += -= *= /= %= | right-associative | +| 23 | comma operator | , | left-associative | ### 6.2. Associativity Rule Sometimes the precedence is not satisfactory to determine the outcome of an expression. There is another rule called associativity. The associativity of operators determines the order of evaluation of operators with the same precedence level.