I know the answer for this will be incredibly simple but it's one of those problems that I can't seem to solve using google/SO because it deals with a character that's hard to search for. I'm getting an xml from a rest api using php. I've used simple_xml_load_string($string) and now when I print_r I get this:
SimpleXMLElement Object
(
[Seaports] => Array
(
[0] => SimpleXMLElement Object
(
[@attributes] => Array
(
[Id] => 8675309
[Name] => CHORIZON WIRELUSS
)
[Statistics] => SimpleXMLElement Object
(
[Clicks] => 194
)
etc
Let's say I want
$xml->Seaports[0]->@attributes['Id']
echo $xml->Seaports[0]->@attributes['Id'];
gives me a syntax error and
echo $xml->Seaports[0]->attributes['Id'];
What am I doing wrong?