Page 1 of 1
URGENT array question
Posted: Thu May 19, 2005 5:11 am
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?
Posted: Thu May 19, 2005 6:52 am
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.
Obvious
Posted: Thu May 19, 2005 6:56 am
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
Re: Obvious
Posted: Thu May 19, 2005 7:44 am
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
yup
Posted: Thu May 19, 2005 10:46 am
by rubberjohn
yes i have tried that but with no success, is there some problem with arrays sort values that are floats?