php判断检测一个数组里有没有重复的值

时间:2014-10-10 17:45:04   收藏:0   阅读:168

php判断检测一个数组里有没有重复的值

php里有一个处理数组重复值得函数array_unique,我们的思路就是用这个函数来实现的。

if (count($array) != count(array_unique($array))) {   
   echo ‘该数组有重复值‘;  
}


评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!