Say you have a string like:
$string = 'hello my name is blah blah and wats yours';
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'.
$variable = 'blah';
Ie, if 'blah' appears back to back - remove one of them.
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.
Any ideas?
edit: i just realised i didn't consider doing a preg_match of simply 'blah blah' with 'blah'.