Quick Sort Question
| From: | Jeff Wilhelm | Date: | Wed, 29 Nov 2000 13:48:11 +0000 |
| Subject: | Quick Sort Question | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-27812@lists.php.net to get a copy of this message | ||
Good day everyone, I have a quick question dealing with sorting. I use the
following code to print a list of the MP3s in a given directory, however I
need some help on sorting the resultant list alphabetically. Currently the
list is simply displayed (I assume in order of date last modified) but I was
hoping to be able to have the entries appear in alphabetical order. I would
apprecaite any help you could give me.
<?
$handle=opendir('.');
while (false!==($file = readdir($handle))) {
if (!is_dir($file)) {
if ($file != "." && $file != ".." &&
ereg(".mp3",$file)) {
$filelink = rawurlencode($file);
echo "<a href='$filelink'>";
$file = ereg_replace (".mp3","",$file);
echo "$file</a>";
echo "<br>";
}
}
}
closedir($handle);
?>
Thanks,
Jeff
--
J.E.F.F. . .W.I.L.H.E.L.M
Email: jeff@jeffwilhelm.com
Phone: jeffwilhelm@sprintpcs.com
Web: http://www.jeffwilhelm.com