Hello everyone.
For example, I have an array which looks like below:
PHP Code:
$mycart
$mycart[0]['product'] = 'ProductA';
$mycart[0]['quantity'] = 10;
$mycart[1]['product'] = 'ProductA';
$mycart[1]['quantity'] = 4;
$mycart[2]['product'] = 'ProductB';
$mycart[2]['quantity'] = 8;
$mycart[3]['product'] = 'ProductB';
$mycart[3]['quantity'] = 8;
I wanted to run a php function, or make one, that can make an array to sum up all the quantity by similar "product":
PHP Code:
$newcart
$newcart[0]['product'] = 'ProductA';
$newcart[0]['quantity'] = 14;
$newcart[1]['product'] = 'ProductB';
$newcart[1]['quantity'] = 16;
is there a function in php that does this?