Hàm PHP next()
Ví dụ
Tua lại phần tử đầu tiên, chuyển sang phần tử tiếp theo rồi trả về bằng hàm 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());
?>
Chạy ví dụ »Định nghĩa và cách sử dụng
Hàm next() di chuyển đến phần tử tiếp theo.
Cú pháp
SimpleXMLIterator::next()
Chi tiết kỹ thuật
Giá trị trả về: | Không có gì |
---|---|
Phiên bản PHP: | 5.0+ |
❮ Tham khảo PHP SimpleXML