I’ll just cut to the chase.
/**
* create an array of all dates between two specified dates
* @param datetime $strDateFrom
* @param datetime $strDateTo
* @return array
*/
function createDateRangeArray($strDateFrom, $strDateTo) {
$aryRange = array();
$iDateFrom = mktime(1, 0, 0, substr($strDateFrom, 5, 2), substr($strDateFrom, 8, 2), substr($strDateFrom, 0, 4));
$iDateTo = mktime(1, 0, 0, substr($strDateTo, 5, 2), substr($strDateTo, 8, 2), substr($strDateTo, 0, 4));
if ($iDateTo >= $iDateFrom) {
array_push($aryRange, date("Y-m-d", $iDateFrom));
while ($iDateFrom < $iDateTo) {
$iDateFrom = $iDateFrom + 86400;
array_push($aryRange, date("Y-m-d", $iDateFrom));
}
}
return $aryRange;
}