In this tutorial, you shall learn about Addition Assignment Operator, its syntax, and how to use this operator in programs, with examples.

PHP – Addition Assignment Operator

Addition assignment operator is used to increase the value in a variable by given value.

The operator takes two operands, and assigns the sum of both the operands to the first operand.


The syntax of using Addition Assignment Operator is

operand1 += operand2

The operation would be similar to the following statement.

operand1 = operand1 + operand2

which translates to the meaning of increasing or incrementing the value of operand1 by the value of operand2.

We can use variable for operand1; variable or value for operand2.



In the following example, we use Addition Assignment Operator to increase the value in variable $x by 10.

PHP Program

$x = 41;

$x += 10;
print_r("Now, x is {$x}.");


PHP - Addition Assignment Operator


In this PHP Tutorial, we learned about Addition Assignment Operator, and how to use it to increase a variable by given value.