我想排序字段END_DATE ASC通過現場END_DATE ASC排序多維數組
我的陣列,這是我的數組(包含更多數據,有時在同一日期)
0 (Array, 5 elements)
type (String, 5 characters) short
description (String, 8 characters) textext
enjoyed (Boolean) FALSE
start_date (String, 24 characters) 2013-12-03T01:00:00.000Z
end_date (String, 24 characters) 2014-01-26T01:00:00.000Z
1 (Array, 5 elements)
type (String, 5 characters) short
description (String, 4 characters) text
enjoyed (Boolean) FALSE
start_date (String, 24 characters) 2013-12-19T01:00:00.000Z
end_date (String, 24 characters) 2014-06-25T02:00:00.000Z
2 (Array, 5 elements)
type (String, 5 characters) short
description (String, 17 characters) black en Platinum
enjoyed (Boolean) FALSE
start_date (String, 24 characters) 2013-12-13T01:00:00.000Z
end_date (String, 24 characters) 2014-01-31T01:00:00.000Z
這是我的嘗試:
function cmp($a, $b)
{
global $array;
return strcmp($array[$a]['end_date'], $array[$b]['end_date']);
}
uksort($array, 'cmp');
但結果是
1
1
1
1
哪裏出問題了?在dateformat?
有人能指引我進入正確的方向還是提供幫助?
W您是否在需要這些值時使用'uksort'?檢查:['usort'](http://php.net/usort) – AmazingDreams