title: php regex how to remove duplicate charactors and make every charactor unique in string
body: <p>How should one use <code>preg_replace()</code> to replace a string from 'aabbaacc' to 'abc'?</p>
  
  <p>Currently, my code uses  <code>str_split()</code> then <code>array_unique()</code> then <code>implode()</code>.
  I think <code>preg_replace()</code> can achieve this also, but I don't know how.</p>
  
  <p>Thank you for your help.</p>