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