PHP hasChildren() Funksie
Voorbeeld
Kontroleer of die huidige element kinders het, of dit het; voer die huidige element uit:
<?php
$bookxml = <<<XML
<bookstore>
<book>
<title>Everyday Italian</title>
<author>Giada De
Laurentiis</author>
</book>
<book>
<title>Harry Potter</title>
<author>J K.
Rowling</author>
</book>
<book>
<title>Learning XML</title>
<author>Erik T. Ray</author>
</book>
</bookstore>
XML;
$xml = new SimpleXMLIterator($bookxml);
for( $xml->rewind(); $xml->valid(); $xml->next() ) {
if($xml->hasChildren())
{
var_dump($xml->current());
echo
"<br>";
}
}
?>
Definisie en gebruik
Die hasChildren()-funksie kontroleer of die huidige element kinders het.
Sintaksis
SimpleXMLIterator::hasChildren()
Tegniese besonderhede
Terugkeerwaarde: | WAAR as die huidige element kinders het. ONWAAR andersins |
---|---|
PHP weergawe: | 5,0+ |
❮ PHP SimpleXML-verwysing