网站制作学习网PHP→正文:php统计数组不同内容数量
字体:

php统计数组不同内容数量

PHP 2012/6/15 19:17:38  点击:不统计


php统计数组不同内容数量
<?php
  $a = array("a","b","c","d","a");
  $b = array("c","d","e","f","c");
  $c = array('F','F','F','F','A');
  $array_all = array($a,$b,$c);
  $temp_array=array(array(),array(),array());//定义临时数组记录数量,源有多少就建立几个
  for($i=0;$i<count($array_all);++$i){
    for($j=0;$j<count($array_all[$i]);++$j){
              if(array_key_exists($array_all[$i][$j],$temp_array[$i])){
     $temp_array[$i][$array_all[$i][$j]]++;
    }else{
     $temp_array[$i][$array_all[$i][$j]]=1; 
    }
    
     }   
  }
  var_dump($temp_array);
?>

 


转载%77%77%77请%2E%66%6F%72%61%73%70%2E%63%6E注明

·上一篇:CodeIgniter You did not select a file to upload >>    ·下一篇:php windows下调用system exec passthru >>
推荐文章
最新文章