children()"HREF="function.simplexml-element-children.html"> Manuál PHP Předcházející Další (no version..."/>
Forum und email
SimpleXMLElement->attributes()

SimpleXMLElement->attributes()

(no version information, might be only in CVS)

SimpleXMLElement->attributes() -- Identifies an element's attributes

Popis

class SimpleXMLElement {

SimpleXMLElement attributes ( [string ns [, bool is_prefix]] )

}

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

Poznámka: SimpleXML vytvořilo pravidlo pro vkládání iterativních vlastností do většiny metod. Nelze je prohlížet pomocí var_dump() nebo čímkoli jiným, co může prověřovat objekty.

Seznam parametrů

ns

An optional namespace for the retrieved attributes

is_prefix

Default to FALSE

Návratové hodnoty

Příklady

Příklad 1. Interpret an XML string

<?php
$string
= <<<XML
<a xmlns:b>
<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";
}
?>

Výše uvedený příklad vypíše:

name="one"
game="lonely"