php统计数组元素重复个数函数
统计数组只要利用count但要统计重复数组我们需要遍历一下数组这样就可以统计出来了,下面一起来看看例子,希望对各位会有所帮助.
PHP实例代码如下:
<?php
$arr=array
(
"01",
"02",
"01",
"02",
"03"
);
$rs=array();
foreach($arr as $v){
if (isset($rs[$v])) {
$rs[$v]++;
} else {
$rs[$v] = 1;
}
}
print_r($rs);
?>永久地址:https://www.phprm.com/shuzu/fs3237.html
转载随意~请带上教程地址吧^^