title: how can i exclude saturday and sunday when i generate dates
body: <p>I'm generating dates using my code I want to exclude sunday and saturday please check my code here</p>
  
  <pre><code>for ($date = $start_date; $date &lt;= $end_date; $date = date('Y-m-d', strtotime($date . ' + 1 day'))) {
  
  $week = date('W', strtotime($date));
  $year = date('Y', strtotime($date));
  $from = date("Y-m-d", strtotime("$date")); 
  if ($from &lt; $start_date)
      $from = $start_date;
  $to = date("Y-m-d", strtotime("$date-1day + 1 week"));   
  if ($to &gt; $end_date) {
      $to = $end_date;
  }
  if ($from &lt;= $to) {
      array_push($weekfrom, $from);
      array_push($weekto, $to);
  }
  
  $n = count($weekfrom);
  
  for ($i = 0; $i &lt; $n; $i++) {
      echo $weekfrom[$i];
  }}
  </code></pre>