<?php
function sortByDate($a, $b) {
return strtotime($a) > strtotime($b);
}
$cont_history = Array (
'20-02-2015' => Array ( 'activity' => 'GATE IN', 'by' => '', 'location' => 'COLOMBO', 'depot' => 'CNLS' ),
'15-03-2015' => Array ( 'activity' => 'GATE OUT', 'by' => '', 'location' => 'COLOMBO', 'depot' => 'CNLS' ),
'18-03-2015' => Array ( 'activity' => 'GATE IN', 'by' => '', 'location' => 'CHENNAI', 'depot' => 'GOBAL'),
'05-04-2015' => Array ( 'activity' => 'GATE OUT', 'by' => '', 'location' => 'CHENNAI', 'depot' => 'GOBAL'),
'10-04-2015' => Array ( 'activity' => 'GATE IN', 'by' => '', 'location' => 'MUMBAI', 'depot' => 'CONS' ),
'13-05-2015' => Array ( 'activity' => 'GATE OUT', 'by' => '', 'location' => 'MUMBAI', 'depot' => 'CONS' ),
'10-02-2015' => Array ( 'activity' => 'Container Bought', 'by' => 'CARU', 'location' => 'COLOMBO', 'depot' => 'CNLS' ),
'07-05-2015' => Array ( 'activity' => 'Container Sold', 'by' => 'TCPL', 'location' => 'MUMBAI', 'depot' => 'CONS' )
);
uksort($cont_history, 'sortByDate');
print_r($cont_history);
preferences:
25.28 ms | 406 KiB | 5 Q