hello,
I have been trying to replace words in a string for a chat room to replace swear words. i need to replace the words whether they are upper/lower or mixed case.
the clean1,2 etc are words that corispont to the swear word, but are cleaner words, this works if they type 'swear1', but not if 'SWEAR1'. this could be fixed for all capitals, but i cant account for every veriation of mixed cases.
$swear = array("swear1", "swear2", "swear3", "swear4");
$clean = array("clean1", "clean2", "clean3", "clean4");
$text = str_replace($swear, $clean, $text);
i have been trying strcasecmp and strtoupper
$text = (strtoupper(str_replace($swear, $clean, $text));
but cant get it to works. please help.
thanks