hi guys,
i can never quite get sorting arrays to work ?
i have a flat database file, database.php …
user1|4
user2|7
user3|15
user4|31
user5|1
i need a script that will read this file into an array then sort the users
in descending order using the number next to each user as the sorting
criteria so it ends up like this …
user4|31
user3|15
shadow|7
admin|4
user5|1
note: I just want the array to be sorted into a second array, i don’t want the order to be saved to the file … so the file will remain the same, but the script will create a second array that is already sorted in order from highest to lowest, and i’ll then code the script to make it display the top 10 users.
can you guys help me with this?
i tried using sort(), asort() and ksort() but they dont work, they treat each line as an entire element and sorts the results by name not by the numerical value.
thanks