Remove duplicates of certain characters from string
<p>How could I remove duplicates of characters found in array <code>$a</code> from string <code>$b</code> only if they are found next to each other?</p>

<pre><code>$a = array("a","b","c");
$b = "aabcccdef";
</code></pre>

<p>Output should be </p>

<pre><code>abcdef
</code></pre>

<p>Characters can be found with a regex but I have no idea how to detect if the characters are next to each other. </p>
