simpleXml object notation not working


I just uploaded a php script that I developed “offline”. Now that it is running on the dreamhost server it is not working the same way. I’ve developed many scripts this way, but this is the first time that something I wrote offline was working differently on my dreamhost server. I am wondering if there is some strange dreamhost setting I should be aware of?

What I am doing is loading an xml string into an xml object, then running queries on that object using “simpleXml object notation”. When offline, the querry returns the ENTIRE ARRAY of data. But when I loaded the script to dreamhost the query only returns the FIRST item in the array.

Here is the code:

// create object
$xmlObj = simplexml_load_string($xmlString, NULL, LIBXML_NOCDATA);

// query object
$ar_time = $xmlObj->data->{‘time-layout’}->{‘start-valid-time’};

// print

Here is what I get when offline: (this is the CORRECT result)

SimpleXMLElement Object
[0] => 2014-03-28T15:00:00-07:00
[1] => 2014-03-28T16:00:00-07:00
[2] => 2014-03-28T17:00:00-07:00
[3] => 2014-03-28T18:00:00-07:00
[4] => 2014-03-28T19:00:00-07:00
[5] => 2014-03-28T20:00:00-07:00
[6] => 2014-03-28T21:00:00-07:00
[7] => 2014-03-28T22:00:00-07:00

Here is what I get with the EXACT SAME 3 lines of code on dreamhost:

SimpleXMLElement Object
[0] => 2014-03-28T15:00:00-07:00

As you can see, the “simpleXml object notation” does not seem to be working the same way on the dreamhost server. The problem is only the first item in the array is being returned.

I figured out that I can use xpath to get the entire array, but since I’ve already written a bunch of code this way I’d rather understand what’s going on… and perhaps not have to rewrite everything, or at the very least I’d be very thankful to learn if there are any special dreamhost/php settings that I should know about in order to avoid re-writing code in the future.

Thanks in advance for your help!