The basic assignment operator is "". At first, we may think it is "equal", but it is not. It actually means assigning the value of the right expression to the number of operations on the left. The value of the value assignment expression is the value assigned. That is to say, the value of "$ a3" is 3. In this way, you can do some tips: the basic assignment operator is "= ". At first, we may think it is "equal", but it is not. It actually means assigning the value of the right expression to the number of operations on the left.
The value of the value assignment expression is the value assigned. That is to say, the value of "$ a = 3" is 3. In this way, you can do some tips:
For an array, the "=>" operator is used to assign values to keys with names. This operator has the same priority as other value assignment operators.
In addition to the basic value assignment operators, there are also "combined operators" suitable for all binary arithmetic, array sets, and string operators ", in this way, you can use its value in an expression and assign the result of the expression to it. for example:
Note that the value assignment operation copies the value of the original variable to the new variable (pass the value assignment), so changing one does not affect the other. This is also suitable for copying some values such as large arrays in dense loops.
In PHP, an exception to the normal value assignment behavior is that when an object is encountered, it is referenced and assigned in PHP 5 unless the clone keyword is explicitly used for copying.
Reference assignment
PHP supports reference assignment, using the "$ var = & $ othervar;" syntax. Referencing a value assignment means that two variables point to the same data without copying anything.
Example #1 reference assignment
Since PHP 5, the new operator automatically returns a reference. Therefore, an E_DEPRECATED error message is sent when the new result is referenced and assigned to PHP 5.3 and later versions, in earlier versions, an E_STRICT error message is sent.
For example, the following code generates a warning: