Skip to content

Instantly share code, notes, and snippets.

@pulading1988
Last active July 31, 2017 09:09
Show Gist options
  • Save pulading1988/b9089e999c053bba9eef542105fb140b to your computer and use it in GitHub Desktop.
Save pulading1988/b9089e999c053bba9eef542105fb140b to your computer and use it in GitHub Desktop.
php二维数组排序
// 先按点赞数据排序,再按评论时间排序
$likeCounts = array();
$reviewTimes = array();
foreach ($commentList as $item) {
$likeCounts[] = $item['likeCount'];
$reviewTimes[] = $item['reviewTime'];
}
array_multisort($likeCounts, SORT_DESC, $reviewTimes, SORT_DESC, $commentList);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment