关于数据排序的问题
Array
(
[175377] => 1
[231940] => 2
[192055] => 2
[231723] => 1
[199305] => 1
[171165] => 4
[220347] => 1
[170288] => 10
[231676] => 1
[228438] => 2
[215878] => 2
[228851] => 1
[194798] => 1
[231220] => 1
[192509] => 1
[231913] => 2
[231731] => 1
[22747] => 1
[171065] => 5
[231922] => 1
[230942] => 15
[231919] => 1
[171397] => 4
[231916] => 1
[209130] => 2
)
这样的数组应该如何排序,根据值的大小进行排序
[230942] => 15,[170288] => 10......
[解决办法]
PHP的数组处理函数有很多,对于排序这样的基础问题,PHP的开发者肯定有注意到。
详见 ksort函数 对数组按照键名排序http://www.php.net/manual/zh/function.ksort.php
ksort($array, SORT_NUMERIC);
[解决办法]
arsort($arr);
[解决办法]
arsort($arr);