时间:2021-07-01 10:21:17 帮助过:15人阅读
$arr=array(38,39,41,38,39,41,42,43);
$c=array_count_values($arr);
function foo($v){
global $c;
if($c[$v]==1){
return true;
}
return false;
}
print_r(array_filter($arr,'foo'));
$ar = array(38, 39, 40, 41, 38, 39, 40, 41, 42, 43);Array ( [0] => 42 [1] => 43 )
foreach(array_count_values($ar) as $k=>$v)
if($v == 1) $res[] = $k;
print_r($res);