I have a very large multidimensional array and I would like to sort it decending by the value of an element. Here's an example of the array:
[match_info]
[123]
[match_id] => [123]
[124]
[match_id[ => [124]
So really, I guess I'd like to sort the data of the initial "name" of the next layer of the array- so the 123 and 124, not the [match_id] (even though they are the same value, I feel like it would be best to just sort from the first value listed). I've been looking at usort but don't fully comprehend the compare functions. Any help would be awesome!
Also, the result I'm looking for is [124] to be above [123] :P
Here's a real excerpt from the array: http://pastebin.com/DTngBiH5 (I hate to link to you an external site but... too large)
I tried asort(); but it remained unchanged since the command wasn't sorting by something (I assume) - Kevin Murphy 2012-04-04 03:09
Have a look at krsort function. It sorts an array by key in reverse order (or just ksort if reverse is not required).
krsort($array['match_info']);
print_r()
output, so we can see exactly how the array is structured? Also, what have you tried so far, what did it do, and what were you expecting? Example data and example code will get you the best/fastest results - ghoti 2012-04-04 02:37