Assignment operators are use to assign a specific value to variable. They are also use to change the existing value of a variable by adding or subtracting from the variable ‘s current value. A few examples are =, +=, -= and .=.
In PHP you can use more than one assignment operator in a single statement, as shown below:
$a = ($b=4) + ($c=5);
The variable $a, $b and $c are now integer types and will hold the values 9, 4 and 5, respectively.
|= (equal to)||$a = 9;||Assign value 9 to variable $a;|
|+= (plus equal to)||$a += 9;||Adds the original value assign to the variable $a to 9. Now the value of $a will be 9.|
|-= (minus equal to)||$a += 3;||Subtract the number specified from the original value of $a. Now the value of $a will be 6.|
|.= (dot equal to)||$a .=” new numbers.”;||(add) the new value specified with the original value of the variable. Now the value of $a will be 9 new numbers.|