Some project required developer to SUM the total value foreach variables in array. For example, if the table have column 'point' which stored the integer value such as 1, 3, 5 etc, the SUM value for the point array could be calculated by using these code:
Total Point:
<?php $sum = 0;
foreach ($users as $user)
{
$sum+= $user['User']['point'];
}
echo $this->Number->precision($sum, 2);
?>
These code should be place at index where the value for each of the point will be display. The precision is '2' which it will produce result with 2 decimal point.
That all. Happy coding.