Well the pattern that you are using is replacing any instance of 3 periods in a row with a single period. So if you started with 9 periods in a row you'd end with 3.
You should probably use the preg functions:
$value = preg_replace("/\\.+/", ".", $words);
This says to replace any place where you find 1 or more periods with a single period. The preg patters are a bit more powerful and definitely more used in the world look at [man]preg_replace/man for more information.