如何通过ssup asc对此数组进行排序?
[xml] => Array
(
[sale] => Array
(
[0] => Array
(
[ref] => 316205
[line] => 3
[partno] => MC41SS
[cust] =>
[date] => 28/ 6/10
[value] =>
[balance] =>
[ssup] => CDA
[stdesc] => CDA Built in/Freestanding M/Wave Grill/Convection Oven
[sdelinfo] =>
)
[1] => Array
(
[ref] => 316657
[line] => 1
[partno] => SRS45E48GB
[cust] =>
[date] => 7/ 7/10
[value] =>
[balance] =>
[ssup] => Bosch
[stdesc] => Bosch S/L 4 Prog Express Wash 49db Dishwasher Silver
[sdelinfo] =>
)
[2] => Array
(
[ref] => 316791
[line] => 1
[partno] => T44T90N0
[cust] =>
[date] => 9/ 7/10
[value] =>
[balance] =>
[ssup] => Neff
[stdesc] => Neff 90cm Front Control Point & Twist Hob St/St
[sdelinfo] =>
)
答案 0 :(得分:5)
使用usort并提供您自己的功能来进行排序,例如
function cmp($a, $b)
{
if ($a['ssup'] == $b['ssup']) {
return 0;
}
return ($a['ssup'] > $b['ssup']) ? -1 : 1;
}
usort($array, "cmp");