Count duplicate values

WBOY
Release: 2016-07-25 09:08:22
Original
961 people have browsed it
Count duplicate values
  1. $array=array(1,2,3,4,5,6,8,5,2,3,6,3,5,2,3,6,5,2, 2);
  2. print_r($array);
  3. echo '
    ';
  4. $b=array_count_values($array);//Count duplicate values
  5. foreach($b as $key=>$value){
  6. if($value>1){
  7. echo 'Duplicate value'.''.$key.''.'---------'.'Duplicate Times'.$value.'
    ';
  8. }
  9. }
Copy code


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template