我有带有意外数量的产品组的多维数组
我想按所有这些组的最低计数对所有这些组进行排序
例如:度假村后的第一组将是输入产品组,因为它的计数最少,然后是输入产品组..等等
这个怎么做?
<?php
$a =
// the output product group
array(
array('id' => 117, 'name' => 'monitor', 'count' => 60),
array('id' => 118, 'name' => 'printer', 'count' => 16),
array('id' => 119, 'name' => 'sound card', 'count' => 19),
// the input product group
array(
array('id' => 120, 'name' => 'keyboard', 'count' => 11),
array('id' => 121, 'name' => 'hard', 'count' => 21),
array('id' => 122, 'name' => 'mouse', 'count' => 24)
)
)
;
// this code does't works good
// Obtain a list of columns
foreach ($a as $key => $row) {
$count[$key] = $row['count'];
}
// Sort the data with mid descending
// Add $data as the last parameter, to sort by the common key
array_multisort($count, SORT_ASC, $a);
echo $count[$key];
?>