note 54581 added to function.scandir
| From: | trevi55 at gmail dot com | Date: | Fri, 08 Jul 2005 12:38:00 +0000 |
| Subject: | note 54581 added to function.scandir | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-91669@lists.php.net to get a copy of this message | ||
For non php5-users here you are this function...
It isn't set the wrapper, but I think it's enough :P.
If no pararameter is set, the scandir() function will scan the local file directory.
Set the optional parameter "$sort" to 1 to reverse the alphabetical-sorting.
<?
function scandir($dir = './', $sort = 0)
{
$dir_open = @ opendir($dir);
if (! $dir_open)
return false;
while (($dir_content = readdir($dir_open)) !== false)
$files[] = $dir_content;
if ($sort == 1)
rsort($files, SORT_STRING);
else
sort($files, SORT_STRING);
return $files;
}
?>
----
Manual Page -- http://www.php.net/manual/en/function.scandir.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+54581
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+54581&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+54581&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+54581&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+54581&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+54581&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+54581&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+54581&report=yes
Search -- http://master.php.net/manage/user-notes.php