-1
Well, the subject may be old, but that doubt has arisen, not patience in rewriting the code...
The following code is not generating a result.
There’s a function that’s basically 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;
}
She’s being called this way:
$Preco1=Preco($matrizPrecos);
The function receives an array containing the prices...
Within the function 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 "house array".
Return the result.
Thanks for your attention!
Okay. What’s the problem ?
– Ricardo Mota
Doesn’t work...
– Raul Castro
I believe information is missing. You do a foreach on $faixaEtaria Where does that come from? And why do you have a & as a function parameter ?
– Ricardo Mota
$faixaEtaria is another array, never zeroed. The "&" would be to refer to the address, since putting normally was not working (as it still does not work). Except "$soma[]", all arrays exist and have content in the code.
– Raul Castro