dragunov Posted August 19, 2010 Share Posted August 19, 2010 HEy Guys Here is a snippet of an array: SimpleXMLElement Object ( [report1] => SimpleXMLElement Object ( [ReportHost] => Array ( [0] => SimpleXMLElement Object ( [HostName] => 192.168.2.34 [startTime] => Thu Dec 17 13:58:49 2009 [stopTime] => Thu Dec 17 15:13:13 2009 [netbios_name] => (unknown) [mac_addr] => (unknown) [dns_name] => (unknown) [os_name] => (unknown) [num_ports] => 2 [num_lo] => 0 [num_med] => 0 [num_hi] => 0 [ReportItem] => Array which is printed using print_r($a) now how can i access [HostName] => 192.168.2.34 in the $a array?? Thanks in advance Link to comment https://forums.phpfreaks.com/topic/211150-regarding-accessing-an-element/ Share on other sites More sharing options...
MadTechie Posted August 19, 2010 Share Posted August 19, 2010 its not an array its an SimpleXMLElement object, try this $a->report1->ReportHost[0]->HostName Link to comment https://forums.phpfreaks.com/topic/211150-regarding-accessing-an-element/#findComment-1101129 Share on other sites More sharing options...
dragunov Posted August 19, 2010 Author Share Posted August 19, 2010 Thanks!! Link to comment https://forums.phpfreaks.com/topic/211150-regarding-accessing-an-element/#findComment-1101135 Share on other sites More sharing options...
MadTechie Posted August 19, 2010 Share Posted August 19, 2010 did it work ? if so please mark as solved (bottom left) Link to comment https://forums.phpfreaks.com/topic/211150-regarding-accessing-an-element/#findComment-1101138 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.