如何在php中对多维数组排序?
我必须在date中键入PHP对给定数组进行排序。我尝试过使用array_multisort进行排序,但无法对其进行排序。哪个更适合usort或array\U multisort如何在php中对多维数组排序?,php,arrays,sorting,Php,Arrays,Sorting,我必须在date中键入PHP对给定数组进行排序。我尝试过使用array_multisort进行排序,但无法对其进行排序。哪个更适合usort或array\U multisort Array ( [165953] => Array ( [0] => Array ( [wallet_transaction_id] => 165953
Array
(
[165953] => Array
(
[0] => Array
(
[wallet_transaction_id] => 165953
[wallet_currency_id] => 2
[description] => updating SC Dollars by 100.00 from PSM product transaction.
[amount] => 100.00
[date] => 2013-11-13 08:08:05
)
[1] => Array
(
[wallet_transaction_id] => 165953
[wallet_currency_id] => 3
[description] => updating Spy Points by 50.00 from PSM product transaction.
[amount] => 50.00
[date] => 2013-11-13 06:08:05
)
)
[165952] => Array
(
[0] => Array
(
[wallet_transaction_id] => 165952
[wallet_currency_id] => 2
[description] => updating SC Dollars by 100.00 from PSM product transaction.
[amount] => 100.00
[date] => 2013-11-13 05:02:11
)
[1] => Array
(
[wallet_transaction_id] => 165952
[wallet_currency_id] => 3
[description] => updating Spy Points by 50.00 from PSM product transaction.
[amount] => 50.00
[date] => 2013-11-13 08:02:11
)
)
)
您应该查看usort函数。让您定义自己的比较函数
您希望结果是什么样的?我假设对于数组中的每个元素(
165953
和165952
),您希望对该数组进行排序。。。是吗?它是复制品。第一个答案在内存和速度方面都最有效。