fork download
  1. <?php
  2. $data = DateTime::createFromFormat('d/m/Y', '09/11/2018'); // Define a data inicial
  3. $fim = DateTime::createFromFormat('d/m/Y', '16/11/2018'); // Define a data final
  4. $intervaloDias = 3; // Define o intervalo de dias
  5.  
  6. while ($data->format('Y-m-d') <= $fim->format('Y-m-d')) { // Verifica se a data é menor que a data final
  7.  
  8. echo $data->format('Y-m-d ') . "\n"; // Escreve a data na tela
  9.  
  10. $data = $data->add(new DateInterval('P'.$intervaloDias.'D')); // Incrementa a data
  11. }
  12. ?>
Success #stdin #stdout 0.01s 82624KB
stdin
Standard input is empty
stdout
2018-11-09 
2018-11-12 
2018-11-15