From b8dac22ae6c4749ec5151db50861a446d6af2aa1 Mon Sep 17 00:00:00 2001 From: Rafal Kupiec Date: Sat, 28 Jul 2018 12:30:07 +0200 Subject: [PATCH] Update page 'P# v1.0 Specification' --- P%23-v1.0-Specification.md | 46 +++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 23 deletions(-) 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.