I want to get the value of array element ad_id from a multidimensional array. When I print this array using print_r($xmls) I get this array:
.....
[5] => SimpleXMLElement Object
(
[@attributes] => Array
(
[ad_id] => 139293
)
[price] => 400,000
[price_comment] => SimpleXMLElement Object
(
)
[location] => Northern NSW
[new_used] => Used
[descript] => Ex fishing fleet mother ship, fully equipped for long range work.
Ideal live aboard cruising /
[Resources] => SimpleXMLElement Object
(
[image] => //imgs.yachthub.com/1/3/9/2/9/3/0_2.jpg
)
)
[6] => SimpleXMLElement Object
(
[@attributes] => Array
(
[ad_id] => 130247
)
[price] => POA
[price_comment] => SimpleXMLElement Object
(
)
[location] => Athens, Greece
[new_used] => Used
[descript] => Luxury motor yacht O’RAMA is 53,54m (175' 7") in length and was built by Golden Yachts in 2009
[Resources] => SimpleXMLElement Object
(
[image] => //imgs.yachthub.com/1/3/0/2/4/7/0_2.jpg
)
)
.....
(It is a much larger array, I am writing only two elements here.) I want to get ad_id. I can get value of image using $xmls->Resources->image; but in case of ad_id, it is not working. Maybe because of special character in @attributes?