I thought this would work
What I want to happen is the variables $totorders,$tot net,$totcharges ,$totmargin are changed in the CALLING function.
But the first one only $totorders gets added.
The others $totnet,$totcha rges,$totmargin do not.
How should I be doing this?
Code:
calling function
{.............
$cols = array($orders,$net,$charges,$margin);
$tots = array(&$totorders,&$totnet,&$totcharges,&$totmargin);
addTotals($cols,$tots);
.............
}
function addTotals(&$columns,&$totals)
{
$size = count($columns);
for($c=0;$c<$size;$c++)
{
$totals[$c] += $columns[$c];
$columns[$c] = 0;
}
}
But the first one only $totorders gets added.
The others $totnet,$totcha rges,$totmargin do not.
How should I be doing this?
Comment