Array Sorting Help
| From: | Herhuth, Ron | Date: | Mon, 16 Feb 2004 16:49:58 +0000 |
| Subject: | Array Sorting Help | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-22847@lists.php.net to get a copy of this message | ||
Before I begin I must admit I am a bit new to arrays so please be gentle.
Here is my situation:
I am building an app that queries the database and brings back a result
set. This resultset contains last name, first name and id.
I am then using the "similar_text" function to weed out only those matches
that fall within a ceratin percentage point...and then placing them into
an array...right now I'm only using a flat indexed array so the array
looks like this :
$matchArray[0] = lastname1
$matchArray[1] = firstname1
$matchArray[2] = numberOfCharsMatch1
$matchArray[3] = percentageMatch1
$matchArray[4] = lastname2
etc...
What I would like to do is to sort the results based on the
"percentageMatch" Obviously my simple flat array will not do the trick.
I have read about multidimensional arrays but to be honest I'm having a
hard time wrapping my grey matter around how to put it into effect here.
How can I go about A) setting up the array correctly...and B) sorting it
correctly?
Thanks a ton!
Ron