Well, the subject may be old but there was this doubt and not patience in rewriting the code ...
The following code is not generating results.
There is a function that basically looks like this:
function Preco(&$p)
{
$soma=array();
foreach ($p as $pcos):
foreach($faixaEtaria as $qtde):
$soma=$pcos*$qtde;
endforeach;
endforeach;
$resultado=array_sum($soma);
return $resultado;
}
It is being called this way:
$Preco1=Preco($matrizPrecos);
The function receives an array containing prices ...
Within the function I create another array, whose elements receive the product between that price array and an array of 'quantities', each.
After, I only ask for the sum of the elements of this "home" array.
I return the result.
Thank you for your attention!