Good evening everyone. I'm stuck in a stalemate I can not solve. I need to return 11 times $tot_formatado
which corresponds to exactly one time for each installment rate present inside the array.
If you repair the $tot_formatado
, I put $array[0]
which returns me the price for the $array[0]
that corresponds to $parc_two
which is 0.055 .
You need to return the 11 values for each index of the array used for the calculation. Example in the background.
function parcelamento ($valor){
$taxa_intermediacao = 0.064; // porcentagem
$taxa_processamento = 0.60; // monetário
$array = array (
$parc_two => 0.055, // porcentagem
$parc_tree => 0.060,
$parc_four => 0.065,
$parc_five => 0.075,
$parc_six => 0.085,
$parc_seven => 0.095,
$parc_eight => 0.105,
$parc_nine => 0.115,
$parc_ten => 0.125,
$parc_eleven => 0.130,
$parc_twelve => 0.135
);
$tot_formatado = number_format ( ( $valor - ( $valor * ( $array[0] + $taxa_intermediacao ) ) - 0.60 ), 2 );
return $tot_formatado;
}
parcelamento($valor);
I think this has some relationship to looping and arrays but I'm not sure how to do it.