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.
<?php
SimpleXMLElement Object
(
[@attributes] => Array
(
[id] => 55555
)
[text] => "hello world"
)
?>
Then using a function
<?php
function xml_attribute($object, $attribute)
{
if(isset($object[$attribute]))
return (string) $object[$attribute];
}
?>
I can get the "id" like this
<?php
print xml_attribute($xml, 'id'); //prints "55555"
?>