PHP next() 函数
定义和用法
next() 函数移动到下一个元素。
实例
返回到第一个元素,移动到下一个元素,然后使用 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(); // 移动到下一个元素 $xml->next(); // 返回当前元素 var_dump($xml->current()); ?>
语法
SimpleXMLIterator::next()
技术细节
| 返回值: | 无返回值。 |
|---|---|
| PHP 版本: | 5.0+ |