I have this code that is working perfectly. My question is how can I sum all the value of $manpowerCost and $otherCharges?
for ($i = 1; $i<=9; $i++) {
$m = '0'.$i;
$sumMc = array();
$revenue = revenue($project, $year.'-'.$m);
$manpowerCost = manpowerCost($project, $year.'-'.$m);
$otherCharges = otherCharges($project, $year.'-'.$m);
$netIncome = netIncome($revenue, $manpowerCost, $otherCharges);
if ($manpowerCost<=0 && $m <= $projected_date){
$manpowerCost = round(($projected_mc * $percentage_mc),2);
$projected_total_mc += $manpowerCost;
$pt = $pt + $manpowerCost;
} else {
$projected_mc = $manpowerCost;
$manpowerCost = $projected_mc;
}
if ($otherCharges<=0 && $m <= $projected_date){
$otherCharges = round(($projected_oc * $percentage_oc),2);
$projected_total_oc += $otherCharges;
$pt = $pt + $otherCharges;
} else {
$projected_oc = $otherCharges;
$otherCharges = $projected_oc;
}
echo '<td>RE:'.number_format($revenue, 2, '.', '').'<br />MC:'.number_format($manpowerCost, 2, '.', '').'<br />OC:'.number_format($otherCharges, 2, '.', '').'<br />NI:'.$netIncome.'</td>';
}