I have a multi dimensional array called $prescriptions.
I want to sum all the values in $prescriptions[copay].
I have tried
$totalcopay=array_sum($profile[copay]);
With no sucess, PHP gives a "You must pass an array to array_sum" error. Any Ideas?
Let's start of with saying I do not know anything about this command.
BUT:
Have you tried :
$copay = $profile[copay];
$totalcopay=array_sum($copay);
J.
Actually... The array is
$profile[COUNT][copay]
to complicate matters
If anyones interested here is how I solved it...
foreach($profile as $key=>$value) { $row=& $profile[$key]; $sumall[]=$row[copay]; }
$totalcopay=array_sum($sumall);