Re: Sorting through an array
| From: | Justin Patrin | Date: | Fri, 09 Apr 2004 16:32:03 +0000 |
| Subject: | Re: Sorting through an array | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-183009@lists.php.net to get a copy of this message | ||
Jamie wrote:
I have an array of song artists and songs indexed by an id, i need a way of taking out all the artists names. However as there are multiple lines for each artist i have come accross a problem when only displaying the artist once. Another problem is that the artists are not grouped together so i need to store the artists that i have already passed and havent been matched so i can check the next artist. I know it sounds confusing, but i hope you understand what i mean! Any help would be appreciated. JamieHere's a real wasy way: $artists = array(); foreach($songs as $song) { $artists[$song['artist']] = $song['artist']; } You'll only ever get one of each artist. Enjoy :-) -- paperCrane <Justin Patrin>