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:[EMAIL PROTECTED]]
Sent: 28 April 2001 13:43
To: [EMAIL PROTECTED]
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]