array order
| From: | Theodore Jones | Date: | Fri, 29 Sep 2000 04:35:56 +0000 |
| Subject: | array order | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-18005@lists.php.net to get a copy of this message | ||
Hello All,
I have a script that iterates through a series of directories as such:
01-07-2000
01-14-2000
02-08-2000
02-16-2000
02-23-2000
03-09-2000
03-24-2000
04-07-2000
04-21-2000
07-15-2000
07-22-2000
09-14-2000
(directory named by date)
when I read all these directories in with an opendir() function and feed them
into an array,
my display order seems to follow no logical order when the page comes out. For
example I would like the "latest" (09-14-2000) directory uploaded to show up at
the top of the list, and the "oldest" 01-07-2000 directory to appear at the
bottom of the list. Instead they display in no logical order...?
Here's the portion of code I'm working with:
$thumb_dir_handle = opendir($thumb_dir);
$a = 0;
while($file = readdir($thumb_dir_handle)) {
if((preg_match('/jpg/',$file)) ||
(preg_match('/png/',$file)) ||
(preg_match('/gif/',$file)) ||
(preg_match('/jpeg/',$file))) {
$file_array[$a] = $file;
$a++;
$file_count = count ($file_array);
}
}
... any ideas most greatfully solicited...
Thanks,
~ Theo