Is there a way to sort a multi-dimensional array?
Yes. Now, what are your criteria for the array being "sorted"?
Well I have an array that looks like this:
array[0] = "data1|data2|data3|data4";
array[1] = "data1|data2|data3|data4";
I need the array sorted by data3. The only way I can think of doing it is by cycling through the array - exploding it and then adding the data to another array. Is that right?
It depends a little bit on whether you need to sort data1, data2, data4 in parallel with data3. If you need to sort data3 and not touch the others, I'd just pass data3 into your sort algorithm and be done.
Basicly, you need to find a "key" that you can sort linearly, and work everything off that as necessary.
Did you ever figure this one out? I'd like to see the code results from it.
The problem is that I don't know PHP. And I wasn't clear what exactly needs to get sorted.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks