duanchuang6978
2014-06-05 11:39
浏览 119
已采纳

php按值对数组进行排序,对于相等的值,按键排序

I have an array

(0=>0,1=>3,2=>3)

I have to sort this array first by values, and for equal values , I have to sort by order of increasing key first.

I have tried to use multisort over the array_keys(SORT_DESC) and array_values(SORT_ASC) separately, but that gives me:

(0=>0,1=>3,2=>3)

but I want

(0=>0,2=>3,1=>3)
  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题