【发布时间】:2011-09-25 17:10:26
【问题描述】:
我有一个如下所述的数组
Array
(
[6] => Array
(
[name] => Extras
[total_products] => 0
[total_sales] => 0
[total_affiliation] => 0
)
[5] => Array
(
[name] => Office Products
[total_products] => 7
[total_sales] => 17
[total_affiliation] => 8
)
[1] => Array
(
[name] => Hardware Parts
[total_products] => 6
[total_sales] => 0
[total_affiliation] => 0
)
)
现在,订单是:附加品、办公用品、硬件零件
我想对主数组进行排序,使其按内部数组的 total_sales 以 desc 顺序排序
因此订单将是:办公产品、附加产品、硬件零件
任何帮助家伙
【问题讨论】:
-
一般来说,当您需要以特殊方式对数组进行排序而常规排序功能无法完成这项工作时,您应该查看u-sort family of functions。
标签: php