Home >Backend Development >PHP Tutorial >What are the assignment operator codes in php?
The assignment operator in PHP assigns values to variables, including ordinary assignment (=), addition assignment (=), subtraction assignment (-=), multiplication assignment (*=), and division assignment (/= ) wait. Union assignment (PHP 7.3 and later) allows multiple values to be assigned to multiple variables at the same time.
Assignment Operator in PHP
What is the assignment operator?
The assignment operator is used to assign a value to a variable.
What assignment operators are there in PHP?
Usage of assignment operator
<code class="php">$x = 5; // 普通赋值 $x += 3; // 加法赋值(将 $x 的值加 3) $x -= 1; // 减法赋值(将 $x 的值减 1) $x *= 2; // 乘法赋值(将 $x 的值乘 2)</code>
Union assignment (PHP 7.3 and later)
Union assignment allows multiple values to be assigned at the same time Give multiple variables.
<code class="php">list($a, $b, $c) = [1, 2, 3]; // 同时将 1、2、3 分别赋值给变量 $a、$b、$c</code>
The above is the detailed content of What are the assignment operator codes in php?. For more information, please follow other related articles on the PHP Chinese website!