Check if current DirectoryIterator item is a directory in PHP
Description
The following code shows how to check if current DirectoryIterator item is a directory.
Example
//w ww. java2 s . c om
//This example lists the directories within the directory of the current script.
<?php
$iterator = new DirectoryIterator(dirname(__FILE__));
foreach ($iterator as $fileinfo) {
if ($fileinfo->isDir()) {
echo $fileinfo->getFilename() . "\n";
}
}
?>
The code above generates the following result.