SimpleXMLElement->attributes
Identifies an element's attributes
&reftitle.description;
SimpleXMLElement
SimpleXMLElementattributes
stringns
boolis_prefix
This function provides the attributes and values defined within an xml tag.
&simplexml.iteration;
&reftitle.parameters;
ns
An optional namespace for the retrieved attributes
is_prefix
Default to &false;
&reftitle.returnvalues;
&reftitle.examples;
Interpret an XML string
1
XML;
$xml = simplexml_load_string($string);
foreach($xml->foo[0]->attributes() as $a => $b) {
echo $a,'="',$b,"\"\n";
}
?>
]]>
&example.outputs;