diff --git a/language/operators.xml b/language/operators.xml index e370cb7466..67779c1ec0 100644 --- a/language/operators.xml +++ b/language/operators.xml @@ -1,10 +1,123 @@ - + Operators + + 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. + + 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) (float) (string) (array) (object) @ + + + right + [ + + + non-associative + new + + + +
+
+
+ Arithmetic Operators @@ -497,119 +610,6 @@ echo "Should be 4: " . $a . "
\n";
- - 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. - - 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 - - - -
-
-
- String Operators