DateTime object is blank
<p>I am trying to convert a date to a DateTime Object. My code works fine on my localhost (php version 5.3) but returns a blank DateTime object on my remote server (php version 5.2.14). Am I missing something really obvious?</p>

<pre><code>&lt;?php
   $d = '2010-01-01';
   $n = new DateTime ( $d );
   print_r($n);   
?&gt;
</code></pre>

<p>// result on localhost:</p>

<pre><code> DateTime Object ( [date] =&gt; 2010-01-01 00:00:00 [timezone_type] =&gt; 3 [timezone] =&gt; UTC )
</code></pre>

<p>// result on remotehost:</p>

<pre><code> DateTime Object ( ) // is blank
</code></pre>

<p>UPDATED EXAMPLE::</p>

<p>Maybe I'm missing something really simple. I've tried it w/ the suggestion from Pooyan but I must be dense:</p>

<pre><code>function changeDate (  ){

$arr = array('2010-01-01' , '2010-01-02' , '2010-01-03');

foreach ( $arr as $k=&gt;$v ){
    $v = new DateTime ( $v );
    $v-&gt;format('Y-m-d');
    $arr[$k] = $v;
}

return $arr;  

}

print_r( changeDate( ) ); // works in php 5.3 but still returns a blank DateTime Object in php 5.2
</code></pre>
