Re: [PHP] Re: naughty words / filter

2003-08-22 Thread Jason Sheets
Try using str_ireplace, it is str_replace but is case insensitive. str_replace and str_ireplace both can take arrays as parameters for the needle, replacement value. The string functions tend to be much faster than regular expressions, in any case you don't need the foreach.. Jason Chris

[PHP] Re: naughty words / filter

2003-08-21 Thread Anthony Ritter
Was able to get this to filter: . ? } $guestbook = stripslashes($message); $this_is_the_message=$guestbook; $dirty_words = array(badword1,badword2,badword3); $message = $this_is_the_message; foreach ($dirty_words as $word){ $message = str_replace($word, , $message); }

[PHP] Re: naughty words / filter

2003-08-21 Thread Chris Kranz
// example #1: in the script the text in the variable $guestbook does not get replaced. ? $dirty_words = array(badword1,badword2,badword3); $guestbook = stripslashes($message); foreach ($dirty_words as $word){ $message = str_replace($word, , $guestbook); } echo $message; ?