我有这个数组,需要重新排序“第四层厚度”最低到最高。不知道我怎么能做到这一点。
有什么想法吗?
[thickness] => Array
(
[0] => Array
(
[TH Thickness ID] => 23
[TH Thickness] => 100
)
[1] => Array
(
[TH Thickness ID] => 24
[TH Thickness] => 120
)
[2] => Array
(
[TH Thickness ID] => 33
[TH Thickness] => 150
)
[3] => Array
(
[TH Thickness ID] => 25
[TH Thickness] => 50
)
[4] => Array
(
[TH Thickness ID] => 21
[TH Thickness] => 60
)
[5] => Array
(
[TH Thickness ID] => 26
[TH Thickness] => 70
)
[6] => Array
(
[TH Thickness ID] => 22
[TH Thickness] => 80
)
)发布于 2014-03-10 20:44:05
PHP >= 5.5.0
array_multisort(array_column($array['thickness'], 'TH Thickness'), SORT_ASC, $array['thickness']);PHP < 5.5.0 -您可以查看您的问题可能重复的内容,或者:
foreach($array['thickness'] as $k => $v) {
$sort[$k] = $v['TH Thickness'];
}
array_multisort($sort, SORT_ASC, $array['thickness']);https://stackoverflow.com/questions/22310865
复制相似问题