title: Remove all duplicate characters in a string?
body: <p>Say I have the following:</p>
  
  <pre><code>$str = "1AAABBCCCDDDDDDD";
  </code></pre>
  
  <p>How can I remove all the duplicate characters in the string? So it would look like this?</p>
  
  <pre><code>$result = "1ABCD";
  </code></pre>