SimpleXMLElement->attributes()
Identifies an element's attributes
Description
SimpleXMLElement
SimpleXMLElementattributes
stringns
boolis_prefix
This function provides the attributes and values defined within an xml tag.
&simplexml.iteration;
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: