(PHP 5, PHP 7, PHP 8)
SimpleXMLIterator::hasChildren — Indique si l'entrée courante de SimpleXML est un objet
Cette méthode vérifie si l'objet courant SimpleXMLIterator a des sous-éléments.
Cette fonction ne contient aucun paramètre.
   true si l'entrée courante a des sous-éléments, false sinon.
  
Exemple #1 Vérifie si un élément a des sous-éléments
<?php
$xml = <<<XML
<books>
    <book>
        <title>PHP Basics</title>
        <author>Jim Smith</author>
    </book>
    <book>XML basics</book>
</books>
XML;
$xmlIterator = new SimpleXMLIterator( $xml );
for( $xmlIterator->rewind(); $xmlIterator->valid(); $xmlIterator->next() ) {
    if($xmlIterator->hasChildren()) {
        var_dump($xmlIterator->current());
    }
}
?>
L'exemple ci-dessus va afficher :
object(SimpleXMLIterator)#2 (2) {
  ["title"]=>
  string(10) "PHP Basics"
  ["author"]=>
  string(9) "Jim Smith"
}