fork(1) download
  1. <?php
  2.  
  3. function gerar_parcelas($y = 2017)
  4. {
  5. $parc = array();
  6. for($i = 1; $i < 13;$i++){
  7. $parc[] = date('Y-m-t', mktime(0,0,0,$i,1,(int)$y));
  8. }
  9. return $parc;
  10. }
  11.  
  12. var_dump(gerar_parcelas(2017));
Success #stdin #stdout 0s 52488KB
stdin
Standard input is empty
stdout
array(12) {
  [0]=>
  string(10) "2017-01-31"
  [1]=>
  string(10) "2017-02-28"
  [2]=>
  string(10) "2017-03-31"
  [3]=>
  string(10) "2017-04-30"
  [4]=>
  string(10) "2017-05-31"
  [5]=>
  string(10) "2017-06-30"
  [6]=>
  string(10) "2017-07-31"
  [7]=>
  string(10) "2017-08-31"
  [8]=>
  string(10) "2017-09-30"
  [9]=>
  string(10) "2017-10-31"
  [10]=>
  string(10) "2017-11-30"
  [11]=>
  string(10) "2017-12-31"
}