2012-04-24 111 views
1

即時通訊從數組中的「時間戳」部分,從最低到最高(ASC)尋找命令以下數組。訂購多維數組

Array 
(
[188] => Array 
    (
     [date] => 28-04-2012 
     [timestamp] => 1335571200 
     [opposition] => Rayleigh 1st XI 
     [teaperson] => 
    ) 

[182] => Array 
    (
     [date] => 08-03-2012 
     [timestamp] => 1331164800 
     [opposition] => Galleywood 1st XI 
     [teaperson] => 33 
    ) 

[180] => Array 
    (
     [date] => 07-07-2012 
     [timestamp] => 1341619200 
     [opposition] => High Roding 1st XI 
     [teaperson] => 45 
    ) 

) 

我已經看到了array_multisort函數,但不確定如何正確使用它。

乾杯

回答

1

使用usort

usort($arr,function($a,$b) {return $a['timestamp']-$b['timestamp'];})