Ok well what i'm trying to do is write a small script that will give the ability to find a var and then place it in a top 10 listing where it should be.. i know tht doesn't make sense so i'll explain..
Lets say i want to list the person who has the most apples to the one who has the least
they have a certain number of apples
tim = 2
john =5
ruby =4
jess =2
matt =1
erin =16
tom =5
dennis = 9
cole =11
fred =3
then i need to print out from greatest to least
Erin 16
Cole 11
Dennis 9
John 5
Tom 5
Ruby 4
Fred 3
Tim 2
Jess 2
I can't seem to think of how to do it.. i know this seems completely noob to ask lol
i thought about putting it in an array but i wasn't sure how i would justify the <=
i assume i need to use sort()
from looking at the sort function you i'm not sure on how it will sort to what i number it.
i'm not quite sure how to use sort in the way that i want to use the array.
if my array is
$apples = array("tim", "john", "ruby", "jess", "matt", "erin", "tom", "dennis", "cole", "fred");
how do i justify who has how many apples before i sort it?
you don't need to just code and paste in here.. i would much rather get advice to learn from. any help would be much appreciated