downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

SimpleXMLIterator::getChildren> <SimpleXMLIterator
[edit] Last updated: Fri, 25 May 2012

view this page in

SimpleXMLIterator::current

(PHP 5 >= 5.1.0)

SimpleXMLIterator::current現在の SimpleXML エントリを返す

説明

public mixed SimpleXMLIterator::current ( void )

このメソッドは、現在の要素の SimpleXMLIterator オブジェクトあるいは NULL を返します。

パラメータ

この関数にはパラメータはありません。

返り値

現在の要素を SimpleXMLIterator オブジェクトで返します。 失敗した場合は NULL を返します。

例1 現在の要素を返す

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

$xmlIterator->rewind(); // 最初の要素に巻き戻します
var_dump($xmlIterator->current());
?>

上の例の出力は以下となります。

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

参考



add a note add a note User Contributed Notes SimpleXMLIterator::current
There are no user contributed notes for this page.

 
show source | credits | stats | sitemap | contact | advertising | mirror sites