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 Quote 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 Quote 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!! Quote 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) Quote Link to comment https://forums.phpfreaks.com/topic/211150-regarding-accessing-an-element/#findComment-1101138 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.