Thread: Array Question
View Single Post
  #1  
Old 08-26-2003, 12:11 PM
 
machnhed1 machnhed1 is offline
 

eXpert
  
Join Date: Feb 2003
Location: Illinois
Posts: 274
 

Default Array Question

Hi Everyone,

I have this array:
Code:
Array ( [0] => Array ( [productid] => 16141 [amount] => 1 ) [1] => Array ( [productid] => 129 [amount] => 1 ) [2] => Array ( [productid] => 16141 [amount] => 1 ) )
I was wondering if there was a function that would take the values of the array and add up the amounts or identical productids so that the result would look something like this:
Code:
Array ( [0] => Array ( [productid] => 16141 [amount] => 2 ) [1] => Array ( [productid] => 129 [amount] => 1 ) )

I looked on php.net, but either I am missing it or it doesn't exist. Hopefully someone knows how to do this.

Thanks
__________________
Following the signature guidelines : xcart pro 3.5.8 - [RedHat]
Reply With Quote