I have a solution that divides the parcels and includes the value of the rest of the division in the first installment, as you can see the same working at phpFiddle
But I have problems when values have a floating point such as 190.75 I'm already using the number_format
function to do currency conversion.
The way it works is if the total value is integer, but I did not want it to be like I did, I actually wanted it to be like this.
$valor_total = 200.75;
$qt_parcelas = 3;
$valor_parcelas = $valor_total / $qt_parcelas;
echo 'o valor de cada parcela eh: '.$valor_parcelas; //cada parcela seria 66.916666..
// mas queria que ficasse assim
// parcela 1: 66.93
// parcela 2: 66.91
// parcela 3: 66.91
Is there any way to do this in php? take the values after the 2 decimal place and add up to the value of the first?