Re: Re: spl DirectoryIterator
| From: | Tijnema ! | Date: | Sun, 08 Apr 2007 07:56:39 +0000 |
| Subject: | Re: Re: spl DirectoryIterator | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-252240@lists.php.net to get a copy of this message | ||
On 4/8/07, itoctopus <newsgroup@itoctopus.com> wrote:
After some testing and reading, I think this function is still experimental. Anyone else has some thoughts on this?I agree with you, this function seems not working correctly. From what i see of my testing is that this makes an array, with some iterators inside it. But all these iterators are the same iterator i started with. Meaning i get an array of all duplicate iterators. This is not what it should do i think, but there's no documentation on the fuction, so i can't compare with the "expected output". Tijnema
-- itoctopus - http://www.itoctopus.com "Matthew Dellar" <matthew.dellar@tesco.net> wrote in message news:AF.30.18682.D3E08164@pb1.pair.com... I have a problem, I need to turn an iterator into an array, but when I do, some methods I need to use stop working. Take a look at the following example: $dir = 'c:/'; $files = new DirectoryIterator($dir); //$files = iterator_to_array($files); foreach ($files as $file) {echo "{$file->getFileName()}<br>";//works echo "{$file->getPath()}<br>";//works} It works as expected. However, when the iterator is turned into an array: $dir = 'c:/'; $files = new DirectoryIterator($dir); $files = iterator_to_array($files); foreach ($files as $file) {echo "{$file->getFileName()}<br>"; //does not work echo "{$file->getPath()}<br>";//works} It stops working. Can someone please help me, as a have tried and failed to find the cause of the problem. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php