fork download
  1. <?php
  2.  
  3. date_default_timezone_set('Europe/Lisbon');
  4. $inicio = new DateTime($start_date);
  5. $fim = new DateTime($end_date);
  6. $fim->modify('+1 day');
  7.  
  8. $interval = new DateInterval('P1D');
  9. $periodo = new DatePeriod($inicio, $interval ,$fim);
  10. foreach($periodo as $data){
  11. // $arrayDiasSemestre[] = $data->format("l");
  12. echo $data->format("l").' é o dia da semana nr: '.$data->format("w");
  13. }
  14.  
Success #stdin #stdout #stderr 0.01s 20568KB
stdin
Standard input is empty
stdout
Saturday é o dia da semana nr: 6
stderr
PHP Notice:  Undefined variable: start_date in /home/KzSCYt/prog.php on line 4
PHP Notice:  Undefined variable: end_date in /home/KzSCYt/prog.php on line 5