If you've created the program, what's stopping you from adding the
highlighting markup at the time of adding the letter? It would be much
easier than having to compare the before and after strings. You won't
be able to simply use regex to determine what one character is not the
same. If you really must determine what has changed after, though,
you could compare the strings like this:
$before = 'each';
$after = 'peach';
$length = strlen($after);
for($n=0;$n<=$length;$n++) {
$char_before = substr($before,$n,1);
$char_after = substr($after,$n,1);
if ( $char_before != $char_after ) {
$after = substr_replace($after,"<strong>$char_after</strong>",$n,1);
break;
}
}
--
Remember, no matter where you go, there you are. -Buckaroo Banzai