On Fri, 19 Jan 2001, Sterling Hughes wrote: > Its a whip up of what I was talking about, I didn't mean it as real code > :)... Switch $words to $word and then swith the argument order to in_array > and yes, it makes sense... > > <?php > $profanities = array("fuck", "shit"); > > $words = preg_split("/\s+/", $data); > foreach ($words as $word) { > if (in_array($word, $profanities)) { > echo "you did a naughty thing"; > break; > } > } > ?> > > > Would be the somewhat sane version... > > _Sterling > It still suffers from failing on "goodf***" and "eats***anddie" because of the lack of spaces. That's why I had to use strpos(). -- Ignacio Vazquez-Abrams <[EMAIL PROTECTED]> -- 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]
- Re: [PHP] Profanity Filter Nik Gare
- Re: [PHP] Profanity Filter Fraser MacKenzie
- Re: [PHP] Profanity Filter Website4S
- Re: [PHP] Profanity Filter Ignacio Vazquez-Abrams
- Re: [PHP] Profanity Filter Sterling Hughes
- Re: [PHP] Profanity Filter Ignacio Vazquez-Abrams
- Re: [PHP] Profanity Filter Sterling Hughes
- Re: [PHP] Profanity Filter Ignacio Vazquez-Abrams
- Re: [PHP] Profanity Filte... Ignacio Vazquez-Abrams
- Re: [PHP] Profanity Filte... Sterling Hughes
- Re: [PHP] Profanity Filte... Ignacio Vazquez-Abrams
- Re: [PHP] Profanity Filte... Sterling Hughes
- Re: [PHP] Profanity Filte... Sterling Hughes
- Re: [PHP] Profanity Filte... Ignacio Vazquez-Abrams
- Re: [PHP] Profanity Filte... Alex Black
- [PHP] CF vs PHP for Creat... DPG Account
- Re: [PHP] CF vs PHP for C... Michael Kimsal
- Re: [PHP] Profanity Filter Egan
- Re: [PHP] Profanity Filter Ignacio Vazquez-Abrams
- RE: [PHP] Profanity Filter DanO