function array_unique_join($arr,$param){ $utm_source_arr = array_unique(array_column($arr,$param)); if(count($utm_source_arr) > 1){ $a = implode('\',\'',$utm_source_arr); $utm_source = "'$a'"; }else{ if(empty($utm_source_arr[0])){ $utm_source_arr[0] = ''; } $utm_source = "'$utm_source_arr[0]'"; } return $utm_source; }