<?php
function parcelas($data, $numero = 12)
{
$parc[] = $data;
for($i = 1; $i < $numero;$i++)
{
$mes++;
if ((int)$mes == 13)
{
$ano++;
$mes = 1;
}
$tira = $dia;
{
$tira--;
}
$parc[] = sprintf("%02d-%02d-%02d", $ano, $mes, $tira); }
return $parc;
}
$data = "2017-01-31";
PD9waHAKCmZ1bmN0aW9uIHBhcmNlbGFzKCRkYXRhLCAkbnVtZXJvID0gMTIpCnsKICAgICRwYXJjID0gYXJyYXkoKTsKICAgICRwYXJjW10gPSAkZGF0YTsKICAgIGxpc3QoJGFubywgJG1lcywgJGRpYSkgPSBleHBsb2RlKCItIiwgJGRhdGEpOwogICAgZm9yKCRpID0gMTsgJGkgPCAkbnVtZXJvOyRpKyspCiAgICB7CiAgICAgICAgJG1lcysrOwogICAgICAgIGlmICgoaW50KSRtZXMgPT0gMTMpCiAgICAgICAgewogICAgICAgICAgICAkYW5vKys7CiAgICAgICAgICAgICRtZXMgPSAxOwogICAgICAgIH0KICAgICAgICAkdGlyYSA9ICRkaWE7CiAgICAgICAgd2hpbGUgKCFjaGVja2RhdGUoJG1lcywgJHRpcmEsICRhbm8pKQogICAgICAgIHsKICAgICAgICAgICAgJHRpcmEtLTsKICAgICAgICB9CiAgICAgICAgJHBhcmNbXSA9IHNwcmludGYoIiUwMmQtJTAyZC0lMDJkIiwgJGFubywgJG1lcywgJHRpcmEpOwogICAgfQogICAgcmV0dXJuICRwYXJjOwp9CgoKJGRhdGEgPSAiMjAxNy0wMS0zMSI7Cgp2YXJfZHVtcChwYXJjZWxhcygkZGF0YSwgMTIpKTs=