On 24-Jul-2001 Ryan Fischer wrote:
> 
> Anyway, here's what I would do:
> 
> function filterWords($str){
>     $badwords = array("shit", "fuck", "ass", "bitch");
>     for($i=0; $i<count($badwords); $i++){
>         $str = $eregi_replace("$badwords[$i]", "*****", $str);
>     }
>     return $str;
> }

Un-tested:
$badpat=join('|', $badwords);
$str = $preg_replace("/\b[$badpat]\b/gi", '!*@', $str);

Regards,
-- 
Don Read                                       [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to 
   steal the neighbor's newspaper, that's the time to do it.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to