Jump to content

[SOLVED] Sum Values without MySQL?


l!m!t

Recommended Posts

 

Hi I am trying to add a loop of values into a total. (like the mYSQL SUM function). Any idea on how I do this without mySQL? I tried array_sum, but cant get it to work. Any easy examples someone could provide would be great.

 

foreach ($file->get_contents() as $item) {
$qty_total = $item['qty'];
}

$actual_cost_array= array($qty_total);
$result=array_sum($actual_cost_array); // <- Should total, but doesn't..

 

If there is an easier way please advise.

 

Thank you.

Link to comment
https://forums.phpfreaks.com/topic/111283-solved-sum-values-without-mysql/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.