OK, this has worked very successfully and processes very quickly...
Function naughtyWords($input)
{
$naughty=array(
"/shit/i"=>"<font color=\"#FF0000\">[censored]</font>",
"/fuck/i"=>"<font color=\"#FF0000\">[censored]</font>",
"/bitch/i"=>"<font color=\"#FF0000\">[censored]</font>"
);
return preg_replace(array_keys($naughty),array_values($naughty),$input);
}
However I tried to add another element to the top of the list:
"/ass$/i"=>"<font color=\"#FF0000\">[censored]</font>",
and it does not work right, from everything I have read that is proper regexp to filter just "ass" not "bass" or "assume" for example. Also, I tried to remove the array_values and just hardcode the [censored] thing in there since that is what I use for all of them, but that didn't work either, does kay not work without values?
Does preg_* use some sort of different regexp syntax?