Before I could get the TableSorter class to run I had came up with a function based on what Shinhan had provided.
function sort2d_bycolumn($array, $column, $method, $has_header)
{
if ($has_header) $header = array_shift($array);
foreach ($array as $key => $row) {
$narray[$key] = $row[$column];
}
array_multisort($narray, $method, $array);
if ($has_header) array_unshift($array, $header);
return $array;
}
- $array is the MD Array you want to sort.
- $column is the column you wish to sort by.
- $method is how you want the sort performed, such as SORT_DESC
- $has_header is set to true if the first row contains header values that you don't want sorted.