How sum array values by unique key

Posted by AndrewSpilak on Stack Overflow See other posts from Stack Overflow or by AndrewSpilak
Published on 2010-03-24T16:10:38Z Indexed on 2010/03/24 16:13 UTC
Read the original article Hit count: 211

Filed under:
|

For example

array (
product1_quantity => 5,
product1_quantity => 1,
product2_quantity => 3,
product2_quantity => 7,
product3_quantity => 2,
)

with result:

product1_quantity - 6, 
product2_quantity - 10, 
product3_quantity - 2

Thanx!

© Stack Overflow or respective owner

Related posts about key

Related posts about value