What does the "+=" operator do in PHP and how is it used in the provided code snippet?
The "+=" operator in PHP is used to add a value to a variable. In the provided code snippet, the variable $total is being incremented by the value of $price for each iteration of the loop. This allows us to calculate the total cost of all items in the shopping cart.
$total = 0;
foreach ($cart as $item) {
$total += $item['price'];
}
echo "Total cost of items in the shopping cart: $" . $total;