From a14d8cc16923d75ce4e4791f4213b1032b773432 Mon Sep 17 00:00:00 2001 From: Tiffany Taylor Date: Tue, 25 Aug 2020 13:02:40 +0000 Subject: [PATCH] add tables for assignment operators git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@350379 c90b9560-bf6c-de11-be94-00142212c4b1 --- language/operators.xml | 142 ++++++++++++++++++++++++++++++++++------- 1 file changed, 120 insertions(+), 22 deletions(-) diff --git a/language/operators.xml b/language/operators.xml index 38b389e137..3d73a0df18 100644 --- a/language/operators.xml +++ b/language/operators.xml @@ -604,6 +604,125 @@ Strict Standards: Assigning the return value of new by reference is deprecated i section of the manual. + + + Arithmetic Assignment Operators + + + + + Example + Equivalent + Operation + + + + + $a += $b + $a = $a + b + Addition + + + $a -= $b + $a = $a - $b + Subtraction + + + $a *= $b + $a = $a * $b + Multiplication + + + $a /= $b + $a = $a / $b + Division + + + $a %= $b + $a = $a % $b + Modulus + + + + + + + + Bitwise Assignment Operators + + + + + Example + Equivalent + Operation + + + + + $a &= $b + $a = $a & $b + Bitwise And + + + $a |= $b + $a = $a | $b + Bitwise Or + + + $a ^= $b + $a = $a ^ $b + Bitwise Xor + + + $a <<= $b + $a = $a << $b + Left Shift + + + $a >>= $b + $a = $a >> $b + Right Shift + + + + + + + + Other Assignment Operators + + + + + Example + Equivalent + Operation + + + + + $a .= $b + $a = $a . $b + String Concatenation + + + $a ??= $b + $a = $a ?? $b + Null Coalesce + + + + + + + + See also the manual sections on + arithmetic operators, bitwise operators, + string operators, and + null coalescing operator. + + @@ -2401,8 +2520,7 @@ bool(false) instanceof does not throw any error if the variable being tested is not - an object, it simply returns &false;. Constants, however, were not allowed - prior to PHP 7.3.0. + an object, it simply returns &false;. Constants, however, are not allowed. Using <literal>instanceof</literal> to test other variables @@ -2425,26 +2543,6 @@ bool(false) bool(false) bool(false) PHP Fatal error: instanceof expects an object instance, constant given -]]> - - - - - As of PHP 7.3.0, constants are allowed on the left-hand-side of the - instanceof operator. - - Using <literal>instanceof</literal> to test constants - - -]]> - - &example.outputs.73; - -