Totally lost here. The output of one record in the array is posted below. I would like to get the sum of all the records in field [5] of the [Transporter Log].
I have tried various variations of the following (which I cut/paste from another thread). $subtotal allows returns '0'. I'm thinking I need to do nested loops to reach the [Transporter Log] array but not sure how to accomplish that. Any guidance would be much appreciated.
$item = $datac; //results of mysql query
foreach($item as $key => $val){
$data[$key] = explode(",", $val);
}
for($k = 1; $k < count($item); $k++){
$subtotal[$k] = substr($data[$k][4],2);
}
foreach($subtotal as $val)
echo $val.' ';
echo 'Newest Sum: '.(array_sum($subtotal));
Here's the output of the first record in the array: