title: remove duplicates from comma separated string
body: <p>Is there a better (faster) solution to remove duplicates from a comma separated string?</p>
  
  <pre><code>public function d($dep) { 
      if (strpos($dep,',') !== false) {
          $nd = explode(',',$dep);
          $oa = array_unique($nd);
          $nx = (count($oa) &gt; 1) ? implode(",",$oa) : $oa[0];
      }
      else {
          $nx = $dep;
      }
  
      return $nx;
  }
  </code></pre>
  
  <p>Thanks guys.</p>