URGENT array question

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
rubberjohn
Forum Contributor
Posts: 193
Joined: Fri Feb 25, 2005 4:03 am

URGENT array question

Post by rubberjohn »

im fast approaching a deadline so any help would be great - sorry if this is an obvious question but i cant figure it out:

how do i sort an associative array based on the values and not the key/index value. i cant use the flip function because the values are not whole numbers and the key/index values are words.

any ideas?
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

First of all, your urgency is irrelevant. We treat every thread with the same priority so in the futur could you please choose your titles more appropriatly.

Secondly, take a look at http://ca.php.net/manual/en/function.arsort.php and its sisters.
rubberjohn
Forum Contributor
Posts: 193
Joined: Fri Feb 25, 2005 4:03 am

Obvious

Post by rubberjohn »

first of all i meant that to mean that i dont have the time to look up what could potentially be a simple solution, not for you lot to drop what you are doing to help me

secondly, give me abit more credit i have already tried those, i dont just come across a problem and post a request for someone else to sort it
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Re: Obvious

Post by hawleyjr »

rubberjohn wrote:secondly, give me abit more credit i have already tried those
Did you try asort()

http://ca.php.net/manual/en/function.asort.php
rubberjohn
Forum Contributor
Posts: 193
Joined: Fri Feb 25, 2005 4:03 am

yup

Post by rubberjohn »

yes i have tried that but with no success, is there some problem with arrays sort values that are floats?
Post Reply