note 121968 deleted from simplexmliterator.rewind by cmb
| From: | cmb@php.net | Date: | Sat, 02 Dec 2017 22:14:47 +0000 |
| Subject: | note 121968 deleted from simplexmliterator.rewind by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-209303@lists.php.net to get a copy of this message | ||
Note Submitter: bmafzallmahmud at gmail dot com
----
<?php
$note=<<<XML
<note>
<to>Afzall</to>
<from>Hasanuzzaman Sobuj</from>
<heading>Reminder</heading>
<body>Don't forget our friendship</body>
</note>
XML;
$xmlIterator = new SimpleXMLIterator($note);
echo "<pre>";
$xmlIterator->rewind(); // rewind means back to the beginning, thats mean prepare to first
element
var_dump($xmlIterator->rewind()); // but show NULL
var_dump($xmlIterator->current()); // see first element you must use" current()"
out put :
NULL
object(SimpleXMLIterator)#2 (1) {
[0]=>
string(6) "Afzall"
}
>?