Here’s a way to filter words that are foul. Here we have a table of blocked words loaded in the DB, then the script test every “word” inside your string versus the list of banned words in our DB. This even gives you what specific “banned words” is being filtered. Enjoy the code.
public function filter_words($string) {
$banned_words = $this->get_bad_words();
$badword = $this->found_bad_word;
for($i=0; $ifound_bad_word = $banned_words[$i];
}
}
if (!empty($this->found_bad_word)) {
return true;
} else {
return false;
}
}
Advertisement


