Removing a duplication of a variable in a string?
<p>Say you have a string like:</p>

<pre><code>  $string = 'hello my name is blah blah and wats yours';
</code></pre>

<p>And you wanted to go through and check for any places where there might be a duplication.. not of any word, but just of the chosen word in this instance 'blah'. </p>

<pre><code>   $variable = 'blah';
</code></pre>

<p>Ie, if 'blah' appears back to back - remove one of them.</p>

<p>I consider splitting the string into an array and if one variable in the array starts with the same word the last one ended with then cut out one and rebuild the string. Seems tedius so this is why I am asking if there might be a simpler way.</p>

<p>Any ideas?</p>

<p>edit: i just realised i didn't consider doing a preg_match of simply 'blah blah' with 'blah'.</p>
