I have 1 bad word per line in the text file. The code is still not filtering out the bad words with a * per character. Any suggestions.
I am using the following code:
$er=0;
Code:
function filter($comments) {
$badwords=file("badwords.txt");
for ($i=0;$i < count($badwords);$i++){
$comments = preg_replace(trim($badwords[$i]),str_repeat("*",strlen($badwords[$i])),$comments);
}
return $comments;
}
if ($er=0) { $comments=filter($comments);}
__________________
Matt
webmaster of Please login or register to view this content. Registration is FREE - Online wedding planning
|