children()

It returns the children of a specified node

Example

<?php
$xml = simplexml_load_file(“test.xml”);
echo “<pre>”;
print_r($xml->children());
?>

Output

SimpleXMLElement Object
(
[server] => Apache
[lan] => PHP
[client] => Javascript
)

XML

<?xml version=”1.0″ encoding=”ISO-8859-1″?>
<web>
<server ver=”5″>Apache</server>
<lan>PHP</lan>
<client>Javascript</client>
</web>


Share