Voting

: zero minus zero?
(Example: nine)

The Note You're Voting On

fernandobassani at gmail dot com
19 years ago
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();
}
?>

<< Back to user notes page

To Top