Hàm next () trong PHP
Thí dụ
Tua lại phần tử đầu tiên, di chuyển đến phần tử tiếp theo và sau đó trả về phần tử đó 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());
?>
Đị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ả lại: | Không |
---|---|
Phiên bản PHP: | 5.0+ |
❮ Tham chiếu PHP SimpleXML