SimpleXMLIterator::getChildren
SimpleXMLIterator::key
SimpleXMLIterator
PHP Manual

# SimpleXMLIterator::hasChildren

(PHP 5 >= 5.1.0)

SimpleXMLIterator::hasChildren — Checks whether the current element has sub elements.

### 설명

bool SimpleXMLIterator::hasChildren ( void )

This method checks whether the current SimpleXMLIterator element has sub-elements.

### 인수

이 함수는 인수가 없습니다.

### 반환값

`TRUE` if the current element has sub-elements, otherwise `FALSE`

### 예제

Example #1 Check whether the current element has sub-elements

`<?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());
}
}
?>`

위 예제의 출력:

    object(SimpleXMLIterator)#2 (2) {
      ["title"]=>
      string(10) "PHP Basics"
      ["author"]=>
      string(9) "Jim Smith"
    }

SimpleXMLIterator::getChildren
SimpleXMLIterator::key
SimpleXMLIterator
PHP Manual