title: php array with date group by week saturday till friday
body: <p>I've an array containing items. Each item has a title and startdate. Now i want to group these items by week. If i look at the documentation, the format->('W')
  weeks starts on monday. I need to change this to saturday. </p>
  
  <pre><code>        $items = [
          [   // friday
              'title'     =&gt; 'test',
              'startdate' =&gt; '2016-03-18',    // first group
          ],
          [   // saturday
              'title'     =&gt; 'test',
              'startdate' =&gt; '2016-03-19', // second group
          ],
          [   // sunday
              'title'     =&gt; 'test',
              'startdate' =&gt; '2016-03-20', // second group
          ],
          [   // monday
              'title'     =&gt; 'test',
              'startdate' =&gt; '2016-03-21', // second group
          ],
          [   // saterday
              'title'     =&gt; 'test',
              'startdate' =&gt; '2016-03-26', // third group
          ],
      ];
  </code></pre>
  
  <p>I've something like this but its not working correctly</p>
  
  <pre><code>        foreach($items as $item) {
              // group by week
              $startDate      =  \DateTime::createFromFormat('Y-m-d', $item['startdate']);
              $currectWeek    = $startDate-&gt;format('W');
              $saturday       = 6;
              $friday         = 5;
  
              $test = clone $startDate;
  
              if($currectWeek !== 5){
                  $test-&gt;modify('last friday');
              }
  
              if($currectWeek !== 6){
                  $test-&gt;modify('next saturday');
              }
  
              $a = $test-&gt;format('W');
  
              if(!isset($items_by_week[$a])){
                  $items_by_week[$a] = [];
              }
  
              $items_by_week[$a][] = [
                  'title'    =&gt; $item['title'],
                  'date'     =&gt; $item['startdate'],
              ];
          }
  </code></pre>