next()

创建于 2024-12-03 / 51
字体: [默认] [大] [更大]

❮ PHP SimpleXML 参考手册

实例

回退到第一个元素,移动到下一个元素,然后用 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();

// move to the next element
$xml->next();

// return current element
var_dump($xml->current());
?> 运行实例 »

定义和用法

next() 函数移动到下一个元素。


语法

SimpleXMLIterator::next()

技术细节

返回值: Nothing
PHP 版本: 5.0+

❮ PHP SimpleXML 参考手册
0 人点赞过