PHP- Display days weekly by giving 2 dates
<p>I'd like display dates by week number between giving 2 dates like example below. Is this possible in PHP?  </p>

<p>if the dates are 2010-12-01 thru 2010-12-19, it will display it as follows.</p>

<pre><code>week-1  
 2010-12-01  
 2010-12-02  
 2010-12-03  
 2010-12-04  
 2010-12-05  
 2010-12-06  
 2010-12-07  
week-2    
 2010-12-08  
 2010-12-09  
 2010-12-10  
 2010-12-11  
 2010-12-12  
 2010-12-13  
 2010-12-14  
week-3  
 2010-12-15  
 2010-12-16  
 2010-12-17  
 2010-12-18  
 2010-12-19  
and so on...  
</code></pre>

<p>I use mysql. It has startdate end enddate fields.
thank you in advance. </p>

<p>I can get how many weeks in those giving 2 dates and display them using a   </p>

<pre><code>datediff('ww', '2010-12-01', '2010-12-19', false); I found on the internet.    
</code></pre>

<p>And I can display dates between two dates as follows. But I am having trouble grouping them by week.  </p>

<pre><code>$sdate = "2010-12-01";
$edate = "2010-12-19";

$days = getDaysInBetween($sdate, $edate);
foreach ($days as $val)  
{  
echo $val;  
} 

function getDaysInBetween($start, $end) {   
// Vars   
$day = 86400; // Day in seconds   
$format = 'Y-m-d'; // Output format (see PHP date funciton)   
$sTime = strtotime($start); // Start as time   
$eTime = strtotime($end); // End as time   
$numDays = round(($eTime - $sTime) / $day) + 1;   
$days = array();   

// Get days   
for ($d = 0; $d &lt; $numDays; $d++) {   
$days[] = date($format, ($sTime + ($d * $day)));   
}   

// Return days   
return $days;   
}
</code></pre>
