作者在 2008-08-16 02:44:48 发布以下内容
<?php
$province=array("liaoning","shanghai","guangdong","liaoning","beijing","shanghai","shanghai");
$province=array_count_values($province); //统计数组元素出现的次数
$province=array_flip($province); //键名与值进行对调
krsort($province); //按数组的索引值降序排列
foreach ($province as $key=>$value) {
echo $key." ".$value."<br>";
}
?>