PHP current()関数
例
最初の要素に巻き戻してから、current()関数で返します。
<?php
$note=<<<XML
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Do not forget me this weekend!</body>
</note>
XML;
$xml = new SimpleXMLIterator($note);
// rewind to the first element
$xml->rewind();
// return current element
var_dump($xml->current());
?>
定義と使用法
current()関数は、現在の要素を返します。
構文
SimpleXMLIterator::current()
技術的な詳細
戻り値: | 成功した現在の要素(SimpleXMLIteratorオブジェクトとして)。失敗するとNULL |
---|---|
PHPバージョン: | 5.0以降 |
❮PHPSimpleXMLリファレンス