simplexml_element->attributes

(no version information, might be only in CVS)

simplexml_element->attributes --  Identifies an element's attributes.

Description

object simplexml_element simplexml_element->attributes ( string data)

This function provides the attributes and values defined within an xml tag.

Nota: SimpleXML possiede regole per aggiungere proprietà iterative a diversi metodi. Queste non possono essere visualizzate con var_dump() o qualsiasi altra cosa che possa esaminare gli oggetti.

Esempio 1. Interpret an XML string

<?php
$string
= <<<XML
<a>
<foo name="one" game="lonely">1</foo>
</a>
XML;

$xml = simplexml_load_string($string);
foreach(
$xml->foo[0]->attributes() as $a => $b) {
    echo
$a,'="',$b,"\"\n";
}
?>

This script will display:

name="one"
game="lonely"