Account
Categories

Add And Assign Operator


The += sign is called the Add AND Assign Operator. It adds the value on the right side to the variable on the left side and stores the result in the same variable.

Syntax:

$variable += value;

Example:

<?php
$x = 10;
$x += 5; // adds 5 to $x, now $x is 15
?>

Output:

15