PHP current() 函数
定义和用法
current() 函数返回当前元素。
实例
返回到第一个元素,然后使用 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::current()
技术细节
| 返回值: | 成功时返回当前元素(作为 SimpleXMLIterator 对象),失败时返回 NULL。 |
|---|---|
| PHP 版本: | 5.0+ |