SimpleXMLIterator::hasChildren
Checks whether the current element has sub elements
&reftitle.description;
public boolSimpleXMLIterator::hasChildren
This method checks whether the current SimpleXMLIterator element has sub-elements.
&reftitle.parameters;
&no.function.parameters;
&reftitle.returnvalues;
&true; if the current element has sub-elements, otherwise &false;
&reftitle.examples;
Check whether the current element has sub-elements
PHP Basics
Jim Smith
XML basics
XML;
$xmlIterator = new SimpleXMLIterator( $xml );
for( $xmlIterator->rewind(); $xmlIterator->valid(); $xmlIterator->next() ) {
if($xmlIterator->hasChildren()) {
var_dump($xmlIterator->current());
}
}
?>
]]>
&example.outputs;
string(10) "PHP Basics"
["author"]=>
string(9) "Jim Smith"
}
]]>