I'm creating a shopping cart and I record the product id's as follows:
array(
636 => 1,
637 => 2
);
Where 636 and 637 refer to the product ID and the value would be the quantity of them. So far so good.
The issue is when I need to update the quantity of one of them. For example the customer wants to add +1 of code 636 and 1 of code 638.
How do I update this array by adding the amount of 636 and still adding 638 to this array.
The same thing should look like this:
array(
636 => 2,
637 => 2,
638 => 1
);
I saw some solutions here but none that worked on this issue.
Thank you in advance.