title: getting error while trying to find sat or sun using php
body: <p>I am trying to find a day who provided by the user and I am getting error:</p>
  
  <blockquote>
    <p>Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 79 bytes) </p>
  </blockquote>
  
  <pre><code>$days = $array('saturday','sunday'); // it's dynamic array
  
  if(sizeof($days)&gt;0) {
  
    foreach($days as $key =&gt; $value) {
      $start  = strtotime("today"); // your start/end dates here
      $end    = strtotime("today +6 years");
      $friday = strtotime(strtolower($value), $start);
  
      while($friday &lt;= $end) {
        //$daysbox[] = date("Y-m-d", $friday);                
      }
    }
  
  }
  </code></pre>