/ Published in: PHP
Very helpful function for sorting multi-dimensional arrays
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// coded by alex dot hristov dot 88 function sortmulti ($array, $index, $order, $natsort=FALSE, $case_sensitive=FALSE) { $temp[$key]=$array[$key][$index]; if(!$natsort) { if ($order=='asc') else } else { if ($case_sensitive===true) else if($order!='asc') } $sorted[]=$array[$key]; else $sorted[$key]=$array[$key]; return $sorted; } return $sorted; }