/**
* takes two dates and returns an array of dates between them
*
* @param date1 The start date of the period.
* @param date2 The end date of the period.
* @param format The format of the date you want to display.
*
* @return array array of dates between the two dates.
*/
function displayDatePeriod( $date1, $date2 , $format = "Y-m-d"){
$periodArray = [];
$period =
new DatePeriod(
new DateTime($date1),
new DateInterval('P1D'),
new DateTime($date2)
);
foreach ($period as $key => $value) {
$periodArray[] = $value->format($format) ;
}
$periodArray[] = $date2 ;
return $periodArray;
}
1