PHP rewind() 函数
定义和用法
rewind() 函数返回到第一个元素。
实例
返回到第一个元素,然后返回它(使用 current()):
<?php $note=<<<XML <note> <to>George</to> <from>John</from> <heading>Reminder</heading> <body>Do not forget the meeting!</body> </note> XML; $xml = new SimpleXMLIterator($note); // 返回到第一个元素 $xml->rewind(); // 返回当前元素 var_dump($xml->current()); ?>
语法
SimpleXMLIterator::rewind()
技术细节
| 返回值: | 无返回值。 |
|---|---|
| PHP 版本: | 5.0+ |