Hi all,
I have an array of dates in format date("m/d/Y"), for example 02/02/2002.
How do I sort this array? Is there any function to covert it from that format to julian date so it is easy to sort?
Thanks.
Mike
Hi all,
I have an array of dates in format date("m/d/Y"), for example 02/02/2002.
How do I sort this array? Is there any function to covert it from that format to julian date so it is easy to sort?
Thanks.
Mike
See the manual for the function usort()
Basically you will be telling the sort algorithm how to determine the sort order.
usort ($myArray, "cmp");
function cmp ($a, $b) {
// The usort function is sending you two dates $a and $b.
// Use your own logic to compare them and return 0,1,-1 as appropriate.
}
--
Roger