排序根據日期陣列我需要根據日期使用PHP降序排序數組對象。我嘗試了下面的代碼,但沒有得到預期的結果。你能建議做這個任務嗎?提前致謝。如何降序
$document_list = array('01-14-2013', '01-12-2013', '04-05-2016');
usort($document_list, array($this, "sortByDate"));
function sortByDate($a, $b) {
return strcmp($b['createdDate'], $a['createdDate']);
}
當我試着這個代碼,它得到錯誤的輸出。
檢查[link](http://stackoverflow.com/questions/15557373/php-sort-array-by-date-value) – Yash
使用'usort($ document_list,「sortByDate」);' – jitendrapurohit