title: PHP Carbon class changing my original variable value
body: <p>I'm trying to make a few navigation buttons in a calendar type thing I'm creating, and I'm using carbon to create the dates.</p>
  
  <p>This is the code in the controller:</p>
  
  <pre><code>if ($date == null) {
      $date = \Carbon\Carbon::now();
  } else {
      $date = \Carbon\Carbon::createFromFormat('Y-m-d', $date);
  }
  $navDays = [
      '-7Days' =&gt; $date-&gt;subDay('7')-&gt;toDateString(),
      '-1Day'  =&gt; $date-&gt;subDay('1')-&gt;toDateString(),
      'Today'    =&gt; $date-&gt;today()-&gt;toDateString(),
      '+1Day'  =&gt; $date-&gt;addDay('1')-&gt;toDateString(),
      '+7Days' =&gt; $date-&gt;addDay('7')-&gt;toDateString()
  ];
  </code></pre>
  
  <p>and then I'm my view, I'm doing this:</p>
  
  <pre><code>@foreach($navDays as $key =&gt; $i)
      &lt;li&gt;
          &lt;a href="/planner/bookings/{{ $i }}" class="small button"&gt;
              {{ $key }}
          &lt;/a&gt;
      &lt;/li&gt;
  @endforeach
  </code></pre>
  
  <p>This problem is, that carbon seems to change the $date during the array creating, because these are the dates I'm getting(with <code>$date</code> being set to <code>2015-11-29</code>):</p>
  
  <pre><code>&lt;ul class="button-group even-5"&gt;
      &lt;li&gt;&lt;a href="/planner/bookings/2015-11-22" class="small button"&gt;-7Days&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href="/planner/bookings/2015-11-21" class="small button"&gt;-1Day&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href="/planner/bookings/2015-12-22" class="small button"&gt;Today&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href="/planner/bookings/2015-11-22" class="small button"&gt;+1Day&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href="/planner/bookings/2015-11-29" class="small button"&gt;+7Days&lt;/a&gt;&lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>Does anybody know what I'm doing wrong?</p>