ksort produces wrong result when dealing with alphanumeric characters

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


        
6条回答
  •  北恋
    北恋 (楼主)
    2021-01-18 19:19

    You'll want to use the SORT_STRING flag. SORT_REGULAR would compare items with their current types, in which case the number 1 does come after the string 'a':

    php -r "echo 1 > 'a' ? 'yes' : 'no';" // yes
    

提交回复
热议问题