php通过内部键排序多维数组

时间:2016-03-13 23:36:28

标签: php sorting multidimensional-array

如果数组的第一个维度是偏移量,我可以找到答案,但如果它们是键,则不能找到答案。我需要通过内部键的值对数组进行排序,同时保持主数组的键完好无损。

考虑这个例子多数组..

$test['first']['count']=23;
$test['first']['name']='foo';
$test['first']['type']='red';

$test['second']['count']=54;
$test['second']['name']='bar';
$test['second']['type']='green';

$test['third']['count']=11;
$test['third']['name']='foobar';
$test['third']['type']='blue';

所以我想根据'count'将数组从最高到最低排序。看看上面,订单就是这个......

$test['second']
$test['first']
$test['third']

怎么解决?帮助表示感谢,谢谢!

0 个答案:

没有答案
相关问题