Overview
KB
Technical FAQ
PHP Manual
CSS2 Manual
HTML Manual
JS Guide
JS Reference
PhpDock Manual
Nu-Coder Manual
PhpExpress Manual
PHP Joomla
Development
Learn PHP
 
<SimpleXMLElement->asXML()SimpleXMLElement->children()>
Last updated: Tue, 19 Sep 2006

SimpleXMLElement->attributes()

(no version information, might be only in CVS)

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

Description

class SimpleXMLElement {

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

}

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

Note: SimpleXML has made a rule of adding iterative properties to most methods. They cannot be viewed using var_dump() or anything else which can examine objects.

Example 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"




<SimpleXMLElement->asXML()SimpleXMLElement->children()>
Last updated: Tue, 19 Sep 2006