asort not working properly alphabetically

时间秒杀一切 提交于 2019-12-12 04:12:46

问题


I have a array like below. I am trying to sort the array alphabetically with asort. but it does not work

Array
(
    [0] => BelExpo exhibition center
    [1] => Aurora cinema theatre
    [2] => Yunost Ice hockey palace
    [3] => Rakauski free market
    [4] => Grushevka Metro Station

)

$arr = asort($arr1); // output gives 1

thanks in advance


回答1:


OK great I solved the problem.

sort return boolean value. no need to put it in variable. just pass the array in sort. and it will work

sort($arr);

print_r($arr);


来源:https://stackoverflow.com/questions/22819397/asort-not-working-properly-alphabetically

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!