1function sortByDate( a, b ) {
2 if ( a.created_at < b.created_at ){
3 return -1;
4 }
5 if ( a.created_at > b.created_at ){
6 return 1;
7 }
8 return 0;
9}
10
11myDates.sort(sortByDate);//myDates is not sorted.
1function cmp($a, $b)
2{
3 return strcmp($a["title"], $b["title"]);
4}
5
6usort($array, "cmp");