Psycho Posted October 9, 2007 Share Posted October 9, 2007 I have an XML document which I am reading in via simplexml_load_file Here is a sample of the output: SimpleXMLElement Object ( [id] => 7870 [title] => Apocalypse Now [format] => SimpleXMLElement Object ( [displayname] => DVD [sortname] => DVD ) ) I can reference the title using $objectVariable->title. But, I cannot reference the format displayname in this manner: $objectVariable->format->displayname The only way I have been able to access that value is using a two-step process such as: $tmpVar = $objectVariable->format; echo $tmpVar->displayname; So, is there a way to access child objects of an object directly? Link to comment https://forums.phpfreaks.com/topic/72527-solved-accessing-child-objects/ Share on other sites More sharing options...
Psycho Posted October 9, 2007 Author Share Posted October 9, 2007 I must have had something else going on, it is now working as I expected. Link to comment https://forums.phpfreaks.com/topic/72527-solved-accessing-child-objects/#findComment-365709 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.