Hello:
I have started a bad word filter script but I'm having some problems. The filter works fine but what I would like to happen is... if a bad word is found i would like it to add $EditText right to the beginning of the $text but only if it has found a bad word.
Any help would be great!
function WordFilter($text) {
$EditText = "This Text Has Been Edited\n";
$badwords = array("badword1","badword2","badword3");
foreach($badwords as $badword) {
$stars = str_repeat("*", strlen($badword));
$text = str_replace($badword, $stars, $text);
}
return $text;
}
echo WordFilter($text);