Howdy folks.
I've got a sorting problem. I have a bunch of data in this format.
[a number] [a mixed array]
so...
[312] ["cow", 2, 3, 4, 6]
[345] ["duck", 2, 5, 4, 6]
[312] ["gnat", 7, 3, 6, 3]
[318] ["cow", 2, 3, 4, 9]
so the first element is a rating. the second element is the array that the rating pertains to. I'm trying to sort this huge list by the rating. The problem is, i can't throw them into a 2d array because some of the ratings are the same and you can't have identical keys. And i tried sorting by the value, but the value is an array itself. I'd like it to sort like this.
[345] ["duck", 2, 5, 4, 6]
[318] ["cow", 2, 3, 4, 9]
[312] ["cow", 2, 3, 4, 6]
[312] ["gnat", 7, 3, 6, 3]
where they're sorted by rating in reverse order much like krsort. if the rating IS the same, it doesn't matter what order they are in as long as they are grouped.
ANy suggestions?
Thanks,
Danny
I've got a sorting problem. I have a bunch of data in this format.
[a number] [a mixed array]
so...
[312] ["cow", 2, 3, 4, 6]
[345] ["duck", 2, 5, 4, 6]
[312] ["gnat", 7, 3, 6, 3]
[318] ["cow", 2, 3, 4, 9]
so the first element is a rating. the second element is the array that the rating pertains to. I'm trying to sort this huge list by the rating. The problem is, i can't throw them into a 2d array because some of the ratings are the same and you can't have identical keys. And i tried sorting by the value, but the value is an array itself. I'd like it to sort like this.
[345] ["duck", 2, 5, 4, 6]
[318] ["cow", 2, 3, 4, 9]
[312] ["cow", 2, 3, 4, 6]
[312] ["gnat", 7, 3, 6, 3]
where they're sorted by rating in reverse order much like krsort. if the rating IS the same, it doesn't matter what order they are in as long as they are grouped.
ANy suggestions?
Thanks,
Danny