I use an array to hold two values from a database search: key = percentage, and value = username. I want to sum all of the percentage (key) values, and it has been suggested that the best way to do this is using the foreach loop. Unfortunately, I really have a hard time wrapping my head around its use.
Can anyone suggest how I can iterate through a foreach loop and sum up all of the percentages based on a matching username value.
Thanks in advance for any help.
Revez