title: PHP DateTime - modify reference
body: <p>I'm trying to modify a DateTime object in a function passed as an reference:</p>
  
  <pre><code>&lt;?php
  $date = new DateTime('2012-02-12');
  
  for($n1 = 0; $n1 &lt; 10; $n1++) {
      $date-&gt;modify('first day of next month');
      setDate($date, 15);
      echo $date-&gt;format('Y-m-d') . "&lt;br /&gt;\n";
  }
  
  function setDate(&amp;$date, $day) {
      $date-&gt;setDate($date-&gt;format('Y'), $date-&gt;format('m'),  $day);
  }
  ?&gt;
  </code></pre>
  
  <p>But the result is not as expected. Did I got something wrong with this references stuff?</p>
  
  <p>EDIT:
  Expected result:
  2012-03-15
  2012-04-15
  ...</p>
  
  <p>Result with function above:
  2012-03-01
  2012-04-01
  ...</p>