Sorting Arrays

From: Date: Fri, 18 Aug 2000 22:25:18 +0000
Subject: Sorting Arrays
Groups: php.general 
Request: Send a blank email to php-general+get-12541@lists.php.net to get a copy of this message
Greetings All, Here is the code $d = dir("jukebox/"); while($artist_list=$d->read()) { if(is_dir("/music/jukebox/$artist_list")) { $artist = array($artist_list); $artist = implode($artist, "<BR>"); sort($artist); if ($artist != "." && $artist != "..") { echo "$artist<BR>\n"; } } } $d->close(); Now what I am trying to do here is to get a listing of all the directories in the folder jukebox. Now I want this list that pulls up to be sorted in alpahbetical order. Right now I want to plug these folders into the variable $artist_list. This variable in turn goes into the array $artist. I then I am trying to sort the variable $artist. What I get is an error that says wrong datatype in sort. The array does display (which this error next to each echo) but it is not sorted. How do I fix this? How do I sort the array like I want to? Thanks -- Phillip S. Baker phillip@wordsandimages.com Words & Images, Inc. 1535 Seabright Avenue, Suite 100, Santa Cruz, CA 95062 Direct Line (831) 420-2641 / Fax (831) 458-0808

« previous php.general (#12541) next »