simplexml_element->attributes Identifies an element's attributes. Description object simplexml_elementsimplexml_element->attributes stringdata This function provides the attributes and values defined within an xml tag. Interpret an XML string 1 XML; $xml = simplexml_load_string($string); foreach($xml->foo[0]->attributes() as $a => $b) { echo $a,'="',$b,"\"\n"; } ?> ]]> This script will display: