Thanks chaps, I managed to do it like this.
while ($x < (strlen($word)-1)){
$two_chars = substr($word,$x,2);
// check if there the same i.e. "SS"
if (substr($two_chars,0,1) == substr($two_chars,1,1)){
// they are so delete it
$word = str_replace($two_chars, substr($two_chars,0,1),$word);
} // end if
$x++;
} // end while
But the preg_replace seems to be the best option. So I'll delete my mess ;o)
Thanks again.