I am using php and have the following structure
<?php if(!empty($bids)): ?>
<?php foreach ($bids as $bid):?>
<tr>
<td><?php if($bid['Bid']['debit'] > 0) : ?><?php echo $bid['Bid']['debit']; ?><?php else: ?> <?php endif; ?></td>
<td><?php if($bid['Bid']['credit'] > 0) : ?><?php echo $bid['Bid']['credit']; ?><?php else: ?> <?php endif; ?></td>
</tr>
<?php endforeach; ?>
<?php endif;?>
Now i need to calculate the sum total in each case. I know its easy but not getting how to use loop within the foreach to calculate the total value. Please suggest how to do that loop.
If suppose for the first td sample output structrue is as like below, i need to add up all and just display 22 and not the array
0 2 0 20