I've looked up various PHP functions like asort() and arsort(), but I can't seem to find a way to sort an array by a specified dimension. For example:
I can't seem to find a function that sorts by a specified type. I programmed a game for my website, and every 30 minutes I have a cron script run that ranks all the users by various stats (attack, defense, spy, sentry). The script used to be able to run almost instantly, but then membership grew to 500, and it started slowing down. Now, membership for my game is at about 1800 in the past 2 months, and the update takes literally 15 minutes to load. The update goes every 30 minutes, so that basically means there is a massive script running 50% of the time. This causes a lot of lag near midnight, when the daily update goes off.
So, my question is, does anyone know if a quick way to sort out an array. In this example, I'd like to be able to sort the array out by attack power, and then by defense power, as quickly as possible.
Any help, or suggestions?