sorting multi dimensional arrays arrayName[int][string]
Posted: Wed Jan 24, 2007 1:53 am
I have a multidimensional array
The first array is indexed, the sub arrays are named
I can see how to sort indexed arrays but how on earth do I sort the arrays, based on the value of string:
I want to sort by date based on the value in
so for example (just displaying to elements and just one named sub element)
after sorting, the array looks like:
I turned the datum string in to a unix time stamp in case some users provide dates in other formats, I tested sorting timestamps and this worked great, on a single dim. array. How do I do this on a multi dim array? I need to move the whole index and not just the value in
as the sub arrays have several named indexes.
The first array is indexed, the sub arrays are named
I can see how to sort indexed arrays but how on earth do I sort the arrays, based on the value of string:
Code: Select all
arrayName[index][string]Code: Select all
newTermineItems[0]["datum"]Code: Select all
newTermineItems[0]["datum"] = "7.12.04";
newTermineItems[1]["datum"] = "5.12.04";Code: Select all
newTermineItems[0]["datum"] = "5.12.04";
newTermineItems[1]["datum"] = "7.12.04";I turned the datum string in to a unix time stamp in case some users provide dates in other formats, I tested sorting timestamps and this worked great, on a single dim. array. How do I do this on a multi dim array? I need to move the whole
Code: Select all
newTermineItems[0]Code: Select all
newTermineItems[0]["datum"]