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.

참고: 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:

name="one"
game="lonely"