Using the following function I can display the years and months between two dates, but how can I add the correct days for each month as another array within each month? I can't just add the days manually as I need it to account for leap years etc. I also need it to tell me what the day is as IN thu, Fri, sat etc..

PHP Code:
function yearMonth($start_date$end_date)
{
    
$begin = new DateTime$start_date );
    
$end = new DateTime$end_date);
    
$interval = new DateInterval('P1M'); // 1 month interval

    
$period = new DatePeriod($begin$interval$end);

    foreach ( 
$period as $dt )
        
$years[$dt->format"Y" )][] = $dt->format"F" );

    return 
$years;
}

$list  =  yearMonth("2007-03-24""2009-06-26");
var_dump($list);