Ok I have posted this before but I may not have been clear enough so I am reposting to see if anyone can help.
My search engine throws the search query words that users use into my database, from there my users can access them to see what are the most common search terms.
I grab the words collected in the database and shove them into an array.
Say the array looks like this:
array = $array("sports, music, music, toys, games, games, sports, sports, toys, music, sports, sports, toys, toys");
Now what I want to do is to be able to sort the array by order of the most instance.
sports has 5 instances
music has 3 instances
toys has 4 instances
games has 2 instances
I want to sort the array like this:
Sports
Sports
Sports
Sports
Sports
Toys
Toys
Toys
Toys
Music
Music
Music
Games
Games
or rather like this:
array = $array("sports, sports, sports, sports, sports, toys, toys, toys, toys, music, music, music, games, games");
Once the above is worked out I can then go ahead and remove duplicate entries.
Thanks for the help everyone.