PHP - While loop

Posted by Karl Entwistle on Stack Overflow See other posts from Stack Overflow or by Karl Entwistle
Published on 2010-03-17T10:35:54Z Indexed on 2010/03/17 10:41 UTC
Read the original article Hit count: 300

Filed under:
|
|
print "<ul>";
foreach ($arr as $value) {
    echo("<li>" . $value[storeid] . " " . ($value[dvdstock] + $value[vhsstock]) . "</li>");
}
print "</ul>";

Will output

•2 20
•2 10
•1 20
•1 20
•1 10

I was wondering how I would adapt this loop so it outputs the total values for each &value[storeid]

•1 50
•2 30

Thanks very much :)

© Stack Overflow or respective owner

Related posts about php

Related posts about loops