It is really simple to access attributes using array form. However, you must convert them to strings or ints if you plan on passing the values to functions.<?phpSimpleXMLElement Object( [@attributes] => Array ( [id] => 55555 ) [text] => "hello world")?>Then using a function<?phpfunction xml_attribute($object, $attribute){ if(isset($object[$attribute])) return (string) $object[$attribute];}?>I can get the "id" like this<?phpprint xml_attribute($xml, 'id'); //prints "55555"?>