bad word filter

From: Date: Tue, 24 Jul 2001 18:24:33 +0000
Subject: bad word filter
Groups: php.general 
Request: Send a blank email to php-general+get-59389@lists.php.net to get a copy of this message
Hello everyone, I've been reading the "Profanity Filter" thread in the list archives but haven't found anything real helpful. Here's my code so far, this of course won't work. <? function filterWords($string, &$result) { $badwords="shit, fuck, ass, bitch"; $word=explode(", ", $badwords); for ($i=0; $i<count($word); $i++) { $replace = str_replace("$word[$i]", "****", $string); } } $string = "Ass monkey"; filterWords("$string", $result); print "$result"; ?> How can I scan for the $badwords in $string and replace $badwords with ****? Thanks, Tyler Longren Captain Jack Communications tyler@captainjack.com www.captainjack.com

« previous php.general (#59389) next »