为啥数据用arsort排序没反应
程序员文章站
2024-02-06 12:13:37
...
为什么数据用arsort排序没反应?
数组内容如下,是一位数组,数组名为$finalData。
Array ( [追求准确] => 1 [适应力强] => 2 [精于分析] => 2 [眼光广阔] => 2 [冷静自信] => 2 [体贴入微] => 2 [鞭策鼓励] => 2 [聪颖过人] => 2 [力争上游] => 2 [恪尽职守] => 2 [深明主次] => 2 [广纳意见] => 2 [忠于合作] => 2 [别具创意] => 2 [待人周到] => 2 [严于律己] => 2 [效率极高] => 2 [善于鼓励] => 1 [有魄力的] => 1 [有始有终] => 1 [努力推进] => 1 [富想像力] => 1 [不偏不倚] => 3 [颠覆性创新] => 1 [博闻好问] => 1 [见识广博] => 0 [逻辑清晰] => 0 [忠诚可靠] => 0 [观察入微] => 0 [善用机会] => 0 [别出心裁] => 0 [爽朗外向] => 0 [坦率直言] => 0 [注重细节] => 0 [坚持不懈] => 0 [令人信服] => 1 [踏实肯干] => 1 [敬业乐业] => 1 [注重现实] => 1 [信赖自己] => 1 [头脑精明] => 1 [专心致志] => 1 [技艺精良] => 1 [坚强不屈] => 1 [有条不紊] => 1 [专横跋扈] => 1 [吹毛求疵] => 1 [颇不耐烦] => 1 [争权结党] => 1 [反复无常] => 1 [退缩忍让] => 1 [粗心善忘] => 1 [畏首畏尾] => 1 [小题大做] => 1 [缺乏耐性] => 1 [冲动莽撞] => 1 [犹豫不决] => 1 [欠缺弹性] => 1 [刻板保守] => 1 [不思进取] => 0 [玩弄权术] => 0 [待人冷漠] => 1 [过于敏感] => 1 [口舌招尤] => 1 [不善委派] => 1 [抱残守阙] => 1 [猜忌多疑] => 1 [行动迟缓] => 1 [山头主义] => 1 [离经叛道] => 0 [不敢尝试] => 0 [不切实际] => 0 )
应用PHP的排序函数
但是最终得不到任何结果。
请问有谁遇到过这样的问题么?或者我的数组有什么问题么?
------解决方案--------------------
数组内容如下,是一位数组,数组名为$finalData。
Array ( [追求准确] => 1 [适应力强] => 2 [精于分析] => 2 [眼光广阔] => 2 [冷静自信] => 2 [体贴入微] => 2 [鞭策鼓励] => 2 [聪颖过人] => 2 [力争上游] => 2 [恪尽职守] => 2 [深明主次] => 2 [广纳意见] => 2 [忠于合作] => 2 [别具创意] => 2 [待人周到] => 2 [严于律己] => 2 [效率极高] => 2 [善于鼓励] => 1 [有魄力的] => 1 [有始有终] => 1 [努力推进] => 1 [富想像力] => 1 [不偏不倚] => 3 [颠覆性创新] => 1 [博闻好问] => 1 [见识广博] => 0 [逻辑清晰] => 0 [忠诚可靠] => 0 [观察入微] => 0 [善用机会] => 0 [别出心裁] => 0 [爽朗外向] => 0 [坦率直言] => 0 [注重细节] => 0 [坚持不懈] => 0 [令人信服] => 1 [踏实肯干] => 1 [敬业乐业] => 1 [注重现实] => 1 [信赖自己] => 1 [头脑精明] => 1 [专心致志] => 1 [技艺精良] => 1 [坚强不屈] => 1 [有条不紊] => 1 [专横跋扈] => 1 [吹毛求疵] => 1 [颇不耐烦] => 1 [争权结党] => 1 [反复无常] => 1 [退缩忍让] => 1 [粗心善忘] => 1 [畏首畏尾] => 1 [小题大做] => 1 [缺乏耐性] => 1 [冲动莽撞] => 1 [犹豫不决] => 1 [欠缺弹性] => 1 [刻板保守] => 1 [不思进取] => 0 [玩弄权术] => 0 [待人冷漠] => 1 [过于敏感] => 1 [口舌招尤] => 1 [不善委派] => 1 [抱残守阙] => 1 [猜忌多疑] => 1 [行动迟缓] => 1 [山头主义] => 1 [离经叛道] => 0 [不敢尝试] => 0 [不切实际] => 0 )
应用PHP的排序函数
$finalData= arsort($finalData);print_r($finalData);
但是最终得不到任何结果。
请问有谁遇到过这样的问题么?或者我的数组有什么问题么?
------解决方案--------------------
arsort($finalData);
print_r($finalData);
//arsort返回值:是否排序成功,而不是排序成功后的数组
相关文章
相关视频
专题推荐
-
独孤九贱-php全栈开发教程
全栈 170W+
主讲:Peter-Zhu 轻松幽默、简短易学,非常适合PHP学习入门
-
玉女心经-web前端开发教程
入门 80W+
主讲:灭绝师太 由浅入深、明快简洁,非常适合前端学习入门
-
天龙八部-实战开发教程
实战 120W+
主讲:西门大官人 思路清晰、严谨规范,适合有一定web编程基础学习
网友评论
文明上网理性发言,请遵守 新闻评论服务协议
我要评论