ksort produces wrong result when dealing with alphanumeric characters

后端 未结 6 794
感动是毒
感动是毒 2021-01-18 18:40
\'7833\',
        \'d\'=>\'1297\',
        \'c\'=>\'341\',
        \'1\'=>\'67\',
        \'b\'=>\'225\',
            


        
6条回答
  •  粉色の甜心
    2021-01-18 18:54

    See this page for an overview of the different sort functions in php: http://php.net/manual/en/array.sorting.php

    If you want it sorted by key, then use asort(), which produces this output:

    Array
    (
        [4] => 22
        [3] => 24
        [2] => 44
        [1] => 67
        [0] => 84
        [b] => 225
        [c] => 341
        [d] => 1297
        [a] => 7833
    )
    

提交回复
热议问题