We can now replace the old fashioned way of listing the content from a directory!
the old way:
<?php
if ($handle = opendir('/home/fernando/temp')) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
print "$file <br />";
}
}
closedir($handle);
}
?>
the new way:
<?php
$dir = new DirectoryIterator('/home/fernando/temp');
while($dir->valid()) {
if(!$dir->isDot()) {
print $dir->current()."<br />";
}
$dir->next();
}
?>