$data = array(
[0] => array(
'hoge' => 6,
'fuga' => 2,
'piyo' => 3
),
[1] => array(
'hoge' => 3,
'fuga' => 2,
'piyo' => 7
),
[2] => array(
'hoge' => 12,
'fuga' => 2,
'piyo' => 7
)
);

//hogeの値でソートする
foreach ($data as $key => $row) {
$hoge[$key] = $row['hoge'];
}
array_multisort($hoge, SORT_DESC, $data);


//hoge, fuga, piyoの値で順にソートする
foreach ($data as $key => $row) {
$hoge[$key] = $row['hoge'];
$fuga[$key] = $row['fuga'];
$piyo[$key] = $row['piyo'];
}
array_multisort($hoge, SORT_DESC, $fuga, SORT_DESC, $piyo, SORT_DESC, $data);


▲上に戻る