I have discovered that when I foreach over a RecursiveDirectoryIterator (see example below) the $item actually turns into a SplFileInfo object. I would expect it to be a RecursiveDirectoryIterator. How do I do a hasChildren() on SplFileInfo?

However, if I change it to a non-recursive, DirectoryIterator, $item is what I would expect, DirectoryIterator. I've tested this with 5.2.8 and 5.3b1. I'm guessing this is an issue with my setup as I'm sure I've gotten this to work before...

$dir = new RecursiveDirectoryIterator('/path/to/dir');
foreach ($dir as $item) {
    print get_class($item) . "\r\n";

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to