Home >Backend Development >PHP Tutorial >请问怎么查数组中的重复内容

请问怎么查数组中的重复内容

WBOY
WBOYOriginal
2016-06-23 14:15:24764browse

请问怎么查数组中的重复内容?并显示出来


回复讨论(解决方案)

什么叫数组中重复的内容,把问题描述清楚别人才好回答!

$a=array("Cat","Dog","Horse","Dog");$c=array_count_values($a); foreach($c as $k=>$v){    if($v>1) $ar[]=$k;}print_r($ar);

 Array
(
    [0] => Dog
)

Statement:
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