note 37375 deleted from function.scandir by aidan
| From: | aidan@php.net | Date: | Fri, 02 Jul 2004 06:08:47 +0000 |
| Subject: | note 37375 deleted from function.scandir by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-72307@lists.php.net to get a copy of this message | ||
Note Submitter: Moritz-G@web.de
----
And here with sorting:
if(!function_exists('scandir'))
{
function scandir($directory, $sorting_order=0)
{
// php.net/scandir (PHP5)
if(!is_dir($directory)) return FALSE;
$files = array();
$fh = opendir($directory);
while (FALSE !== ($filename = readdir($fh)))
{
$files[] = $filename;
}
closedir($fh);
if($sorting_order==1) rsort($files);
else sort($files);
return $files;
}
}