function listDateInArray($date1, $date2, $format = 'Y-m-d' ) {
$dates = array();
$current = strtotime($date1);
$date2 = strtotime($date2);
$stepVal = '+1 day';
while( $current <= $date2 ) {
$dates[] = date($format, $current);
$current = strtotime($stepVal, $current);
}
return $dates;
}
print_r(listDateInArray($from, $to, $format = 'Y-m-d' ));