title: PHP push_array objects showing same value
body: <p>i am trying to get the year month from 2018-01-06 to till day using the php datetime object using the code </p>
  
  <pre><code>function getMonths(){
      $st_date = new DateTime('2019-01-01');
      $yms = array($st_date);
      while($st_date &lt; new DateTime()){
          array_push($yms, $st_date-&gt;add(new DateInterval('P1M')));
      }
      print_r($yms);
  }
  </code></pre>
  
  <p>But the ouput is showing the same values on all the items in the array $yms</p>
  
  <pre><code>Array
  (
  [0] =&gt; DateTime Object
      (
          [date] =&gt; 2019-03-01 00:00:00
          [timezone_type] =&gt; 3
          [timezone] =&gt; Asia/Kolkata
      )
  
  [1] =&gt; DateTime Object
      (
          [date] =&gt; 2019-03-01 00:00:00
          [timezone_type] =&gt; 3
          [timezone] =&gt; Asia/Kolkata
      )
  ....
  
  )
  </code></pre>