How to have a stable sort in PHP with arsort()?

后端 未结 7 714
迷失自我
迷失自我 2020-12-03 22:40

i need to sort an array in php based on value, array use some numbers for keys and values, for example like this:

$a = array(70 => 1 ,82          


        
7条回答
  •  清歌不尽
    2020-12-03 23:25

    You can create your own sorting function to meet your customized sorting criteria and then use usort() to iterate all over the array using the function you created to sort the array.

提交回复
热议问题