RE: [PHP] sorting filenames using opendir and readdir
| From: | Taylor, Stewart | Date: | Sat, 28 Apr 2001 12:48:09 +0000 |
| Subject: | RE: [PHP] sorting filenames using opendir and readdir | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-50753@lists.php.net to get a copy of this message | ||
Read them into an array then sort the array.
while more files
{
get file name
$arrFilenames[] = $filename;
$arrFilenames = array_sort($arrFilenames);
}
The above sorts the array each time a file is read as you requested,
however its more efficient to read them all in then sort
while more files
{
get file name
$arrFilenames[] = $filename;
}
$arrFilenames = array_sort($arrFilenames);
-Stewart;
-----Original Message-----
From: Johannes Rumpf [mailto:jor@gmx.at]
Sent: 28 April 2001 13:43
To: php-general@lists.php.net
Subject: [PHP] sorting filenames using opendir and readdir
Hi!
I wanted to get a txt files in a dircetory, I wrote the script using
opendir and readdir functions. But now I would like to sort the files
while I read them in. how could I solve this problem?
Greetings,
Johannes Rumpf
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net