- array_push: documentation ( source)
- print_r: documentation ( source)
- date: documentation ( source)
- strtotime: documentation ( source)
<?php
/* Generates a range of dates */
function dateRange( $first, $last, $step = '+1 day', $format = 'l jS F Y' ) {
$dates = array();
$current = strtotime( $first );
$last = strtotime( $last );
while( $current <= $last ) {
$dates[] = date( $format, $current );
$current = strtotime( $step, $current );
}
return $dates;
}
$Event_Date = '2015-08-09';
$Event_End_Date = '2015-08-19';
$availability_range = array();
$date_start = date('l jS F Y',strtotime($Event_Date));
$date_end = date('l jS F Y',strtotime($Event_End_Date));
$range = dateRange( $date_start, $date_end );
foreach ($range as $key => $date) {
array_push($availability_range, $date);
}
print_r( $availability_range);