php

php 날짜 하루씩 더해서 출력

xemaker 2025. 1. 24. 15:19

php 날짜 하루씩 더해서 출력 하는 방법

$start_date = $_REQUEST["start_date"];
$end_date = $_REQUEST["end_date"];

$start_date = str_replace("-","",$start_date);
$end_date = str_replace("-","",$end_date);

if( strlen($start_date)!=8 || str_len($end_date) != 8){
  echo "날짜 형식이 잘못되었습니다.";
} else {
  whihle($start_date <= $end_date){
    echo $start_date;
    echo "<br>";

    $start_date = date("Ymd", strtotime($start_date."+1 days"));

  }
}