3
THIS EXAMPLE ONLY RETURNS ME THE FIRST ITEM;
$parcelas = 2;
$valor = 1500;
$date = '2019-12-23';
$valor_parcela = $valor / $parcelas;
$boletos = [];
for (
$i = 1;
$i <= $parcelas;
$i++
) {
$date_sum_month = date('d/m/Y', strtotime("+{$i} month", strtotime($date)));
$boletos += ["numero" => $i, "date" => $date_sum_month, "valor" => $valor_parcela];
}
return json_encode($boletos);
}
RETURN
{
"numero": 1,
"date": "23/01/2020",
"valor": 750
}
DESIRABLE RETURN
{
"numero": 1,
"date": "23/01/2020",
"valor": 750
}
{
"numero": 2,
"date": "23/02/2020",
"valor": 750
}
.
.
.
.