PHP rewind()関数
例
最初の要素に巻き戻してから、それを返します(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());
?>
定義と使用法
rewind()関数は、最初の要素に巻き戻します。
構文
SimpleXMLIterator::rewind()
技術的な詳細
戻り値: | 何もない |
---|---|
PHPバージョン: | 5.0以降 |
❮PHPSimpleXMLリファレンス