I have an object returned from $xml = simplexml_load_file($file). I'm trying to access 'location-id' and 'item-id', but I can't figure out how to access those pieces of info. If it only nested once, I know I could do something like $xml->{'item-id'} but it doesn't seem to work. What is the syntax for this? Sorry for the lack of formatting.. that's how it was returned on my browser.
SimpleXMLElement Object (
[item] => Array (
[0] => SimpleXMLElement Object (
[@attributes] => Array (
[item-id] => AAA )
[locations] => SimpleXMLElement Object (
[location] => SimpleXMLElement Object (
[@attributes] => Array (
[location-id] => 111
)
[quantity] => 1
[pick-up-now-eligible] => false
)
)
)
[1] => SimpleXMLElement Object
[@attributes] => Array (
[item-id] => BBB
)
[locations] => SimpleXMLElement Object (
[location] => SimpleXMLElement Object (
[@attributes] => Array (
[location-id] => 111
)
[quantity] => 1
[pick-up-now-eligible] => false
)
)
)
)
)
Could somebody chime in? TIA!!