php之字符串“,”间隔去重

 

//字符串123,123,456,4565,2123 类似字符串去重复
function string_unique($str,$delimiter=','){
 $to_arry = explode($delimiter,$str);
 $to_arry = array_flip(array_flip($to_arry));
 $toreturn = implode($delimiter,$to_arry);
 return $toreturn;
}