if (count($array) != count(array_unique($array))) { echo '该数组有重复值'; }
$arr = [1,2,3,3]; $temp = null; foreach ($arr as $item) { if($temp !== $item){ $temp = $item; }else{ echo "有重复值".$temp; } }