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

后端 未结 7 701
迷失自我
迷失自我 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:23

    For reference, I've put a set of stable sort variants of builtin PHP functions on Github: https://github.com/vanderlee/PHP-stable-sort-functions, based on @Barmar's solution and a few other tricks.

提交回复
热议问题