Skip to content

Instantly share code, notes, and snippets.

@rodrigocorreaecastro
Last active March 25, 2022 16:27
Show Gist options
  • Select an option

  • Save rodrigocorreaecastro/49168442d12e4622df53 to your computer and use it in GitHub Desktop.

Select an option

Save rodrigocorreaecastro/49168442d12e4622df53 to your computer and use it in GitHub Desktop.
Gerar parcelas
<?php
$debug = 'Y';
$dt_venc = '2022-03';
$qnt_parcelas = 6
//Prepara as parcelas por mês
for($i=0;$i <= $qnt_parcelas; $i++):
$dt_venc_mes = strtotime ( "+$i month" , strtotime ( $dt_venc ) ) ;
$dt_venc_mes = date ( 'Y-m' , $dt_venc_mes );
$timestamp = strtotime($dt_venc_mes);
echo ($debug == 'Y')? "(",$i, ", '",$dt_venc_mes,"', ",$timestamp,")" . PHP_EOL : null ;
endif; //.for -> final preparação das parcelas por mês
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment