/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function array_sort($array, $on, $order=SORT_ASC) { foreach ($array as $k => $v) { foreach ($v as $k2 => $v2) { if ($k2 == $on) { $sortable_array[$k] = $v2; } } } else { $sortable_array[$k] = $v; } } switch ($order) { case SORT_ASC: break; case SORT_DESC: break; } foreach ($sortable_array as $k => $v) { $new_array[$k] = $array[$k]; } } return $new_array; }