str_ireplace can be done case insensitively. If you need more complex checks such as containing a phrase, then a pcre with preg_replace would be easier.
This one looks like it will do the job I need it for, thanks.
I had been racking my brain for a way to use an array that contains the badword and good work so the script would have checked for the first and replaced with the associated good word. but this method will work for me i hope.
str_ireplace can be done case insensitively. If you need more complex checks such as containing a phrase, then a pcre with preg_replace would be easier.