I have a PHP array that looks like this: http://pastie.org/1346063 (see pastie for array example)
What I want to do is re-sort that array into another array that is sorted by each array's [votes][POINTS] sub-array numerically descending. The array with the highest [votes][POINTS] value will be the first listed in the main array.
Solution:-
Suppose, your array is stored in a variable named $data
You can simply sort your multi-dimensional array with array_multisort
Hope this helps.
Using the
usort()
function we can create our own comparison function:Results:
Using test data with a similar structure as yours: