Sephiroth_, you obviously don't know the difference between $replace and $replacex. The behavior of $replace is to not ignore replacements that have already been made, $replacex doesn't do this.

Code:
//echo $replace(abcd,a,b,b,z)
will return zzcd

Code:
//echo $replacex(abcd,a,b,b,z)
will return bzcd