2013-11-15 112 views
0

我必须对日期中的给定数组排序PHP。我已经尝试使用array_multisort,但无法对其进行排序。哪一个更适合usort或array_multisort?如何在PHP中对多维数组进行排序?

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 
       ) 

     ) 
) 
+0

你想要结果看起来像什么?我假设数组中的每个元素('165953'和'165952'),你想对这个数组进行排序......是吗? –

+0

它是重复的。那里的第一个答案是最好的记忆方式和速度方式。 – Alex

+0

数组已更新。 – shiv

回答

相关问题