/ Published in: PHP
The following shoud do it. pass the array, index is what element you want to sort on (in your case use 3). Then you can sort asc or desc, and weather you want to use natural sorting (the way a human would sort, 2 before 10) and lastly case sensitive or not if using natural sort. Only the first 2 args are needed, the rest will default.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function sort2d ($array, $index, $order='asc', $natsort=FALSE, $case_sensitive=FALSE) { { $temp[$key]=$array[$key][$index]; if(!$natsort) else { if($order!='asc') } return $sorted; } return $array; }
URL: http://www.codingforums.com/showthread.php?t=71904