I am currently creating a sorting method that consists of values from an mysql query.
Here\'s a brief view of the array:
Array
(
[0]
Finally found this wonderful function at PHP.net:
function array_msort($array, $cols)
{
$colarr = array();
foreach ($cols as $col => $order) {
$colarr[$col] = array();
foreach ($array as $k => $row) { $colarr[$col]['_'.$k] = strtolower($row[$col]); }
}
$eval = 'array_multisort(';
foreach ($cols as $col => $order) {
$eval .= '$colarr[\''.$col.'\'],'.$order.',';
}
$eval = substr($eval,0,-1).');';
eval($eval);
$ret = array();
foreach ($colarr as $col => $arr) {
foreach ($arr as $k => $v) {
$k = substr($k,1);
if (!isset($ret[$k])) $ret[$k] = $array[$k];
$ret[$k][$col] = $array[$k][$col];
}
}
return $ret;
}
This is how each country looks like: $array['countries'] = in_array($needle, $haystack); }
$array = $array = array_msort($array, array('countries'=>SORT_DESC, 'id'=>SORT_ASC));
Thanks all for your help!