I am looking to add up all the $profit with its associated array ($mfgname).
$i=0;
while ($i < $num) {
...
$array[$mfgname] = $profittotal + $profit;
echo $mfgname . " | " . $profit . "<br/>";
...
$i++; }
Spits out:
Mfgname1 | 5.00
Mfgname3 | 1.00
Mfgname1 | -1.00
Mfgname2 | 10.00
Mfgname3 | 4.50
Mfgname2 | -5.00
Profits are correct, however the array is only spitting out the last profit shown for the Mfg:
Array (
[Mfgname1] => -1.00
[Mfgname2] => -5.00
[Mfgname3] => 4.50
)
I am trying to add them up if it is associated with that Mfgname. I believe I have to find the array value in the while loop and try and add it to the newest output $profit. Any ideas?
I am not sure what are you trying to do but here goes my guess
Instead of