Get all week start date and end date within a date range in php
<p>How to get all week start date and end date within a date range in PHP?</p>

<p>Week start = Sunday and week end = Saturday</p>

<p>Input</p>

<blockquote>
  <p>$start_date='2013-02-01'<br>
  $end_date = '2013-02-28'</p>
</blockquote>

<p>Output</p>

<blockquote>
  <p>start date='2013-02-01' End date ='2013-02-02'<br>
  start date='2013-02-03' End date ='2013-02-09'<br>
  start date='2013-02-10' End date ='2013-02-16'<br>
  start date='2013-02-17' End date ='2013-02-23'<br>
  start date='2013-02-24' End date ='2013-02-28'  </p>
</blockquote>

<p>Below code return the week start and end of the date given</p>

<pre><code> function getWeekDates($date)
{
    $week =  date('W', strtotime($date));
    $year =  date('Y', strtotime($date));
    $from = date("Y-m-d", strtotime("{$year}-W{$week}-1")); //Returns the date of monday in week
    $to = date("Y-m-d", strtotime("{$year}-W{$week}-7"));   //Returns the date of sunday in week
    echo "Start Date--&gt;".$from."End Date --&gt;".$to;//Output : Start Date--&gt;2012-09-03 End Date--&gt;2012-09-09
}
</code></pre>

<p>How can I get the result above?</p>
