SimpleXMLElement->attributes
(no version information, might be only in CVS) SimpleXMLElement->attributes --
Identifies an element's attributes
DescriptionSimpleXMLElement simplexml_element->attributes ( string data ) This function provides the attributes and values defined within an xml tag.
Замечание: SimpleXML содержит правило добавления
итеративных свойств к большинству методов. Они не могут быть просмотрены с испольванием
var_dump() или каких-либо других средств анализа объектов.
Пример 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:
|
|