title: Date order 2 days ahead
body: <pre><code>$datetime = new \DateTime();
  
  
  $listItem = array('&lt;li"&gt;', '&lt;/li&gt;');
  $listItem_active = array('&lt;li class="active-day"&gt;', '&lt;/li&gt;');
  
  $i = 0;
  while (true) {
  
      if ($i === 5) break;
  
      if ($datetime-&gt;format('N') === '7' &amp;&amp; $i === 0) {
          $datetime-&gt;add(new \DateInterval('P1D'));
          continue;        
      }
  
      if($i===0){
          $today = $datetime-&gt;format('D d-m');
      }
      if($i===3){
          echo $listItem_active[0] . $today . $listItem_active[1];
      }
      if($i!=0){
          echo $listItem[0] . $datetime-&gt;format('D d-m') . $listItem[1];
      }
  
      $listItem = array('&lt;li&gt;', '&lt;/li&gt;');    
  
      $datetime-&gt;add(new \DateInterval('P1D'));
  
      $i++;
  }
  </code></pre>
  
  <p>I have the above code made and its almost right, but the output is not exactly how i want it. I get the following output: 
  <a href="https://i.stack.imgur.com/LpzKG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LpzKG.png" alt="enter image description here"></a></p>
  
  <p>The current day should always be in the middle. as you can see this works. but the order of the days is not as i desire. The order i desire is this : </p>
  
  <p><a href="https://i.stack.imgur.com/jPQX1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jPQX1.png" alt="enter image description here"></a></p>