SimpleXMLIterator
PHP Manual

SimpleXMLIterator::current

(PHP 5 >= 5.1.0)

SimpleXMLIterator::currentReturns the current element

설명

mixed SimpleXMLIterator::current ( void )

This method returns the current element as a SimpleXMLIterator object or NULL.

인수

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

반환값

Returns the current element as a SimpleXMLIterator object or NULL on failure.

예제

Example #1 Return the current element

<?php
$xmlIterator 
= new SimpleXMLIterator('<books><book>PHP basics</book><book>XML basics</book></books>');
var_dump($xmlIterator->current());

$xmlIterator->rewind(); // rewind to first element
var_dump($xmlIterator->current());
?>

위 예제의 출력:

NULL
object(SimpleXMLIterator)#2 (1) {
  [0]=>
  string(10) "PHP basics"
}


SimpleXMLIterator
PHP Manual