Jump to content

[SOLVED] Printing stdClass objects from an array


writer

Recommended Posts

I've got this massive amount of data coming from a WSDL that produces movie theaters and times. It's for an open-source local news site that I'm going to be handing out to struggling newspapers

 

I'm having trouble parsing this, or printing it, in the ways that I've learned so far in my nascent PHP career -- so I'd like to ask you guys: How do you print elements individual elements when the print_r($variable) command turns out like this?

 

I wish it was like this:

echo $results[0][theater];

 

But that produces this error:

Fatal error: Cannot use object of type stdClass as array in /home/taylorwb/public_html/localmost/movies/test.php on line 9

 

 

Here's what an individual array element looks like:

stdClass Object ( [Theater] => Array ( [0] => stdClass Object ( [Name] => CineArts at Palo Alto Square [Address] => 3000 El Camino Real, Bldg. #6, Palo Alto, CA [Movies] => stdClass Object ( [Movie] => Array ( [0] => stdClass Object ( [Rating] => PG-13 [Name] => Reprise [RunningTime] => 1 hr 43 mins [showTimes] => 1:30pm | 4:10pm | 7:00pm | 9:40pm ) [1] => stdClass Object ( [Name] => The Visitor [showTimes] => 2:00pm | 4:30pm | 7:10pm | 9:35pm ) ) ) )

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.