note 60660 deleted from class.dir by nlopess
| From: | nlopess@php.net | Date: | Fri, 13 Jan 2006 12:47:11 +0000 |
| Subject: | note 60660 deleted from class.dir by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-101699@lists.php.net to get a copy of this message | ||
Note Submitter:
----
Regarding jaqb's post about a correction to the read_dir function, I have one small fix too if
people wish to also list the directories inside this directory and read them into the same array.
<?
function read_dir($dir) {
$array = array();
$d = dir($dir);
while (false !== ($entry = $d->read())) {
if($entry!='.' && $entry!='..') {
$entry = $dir.'/'.$entry;
if(is_dir($entry)) {
$array[] = $entry;
$array = array_merge($array, read_dir($entry));
} else {
$array[] = $entry;
}
}
}
$d->close();
return $array;
}
?>