RecursiveDirectoryIterator and foreach

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux