Re: Profanity Filter
| From: | Ignacio Vazquez-Abrams | Date: | Fri, 19 Jan 2001 19:44:23 +0000 |
| Subject: | Re: Profanity Filter | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-35708@lists.php.net to get a copy of this message | ||
On Fri, 19 Jan 2001, Sterling Hughes wrote:
> I'm saying use the same method, but use an array and avoid the strpos()
> function:
>
> $words = preg_split("//", $data);
> foreach ($words as $word) {
> if (in_array($prof, $words)) {
> echo "BAD WORD";
> echo "BAD WORD";
> echo "I'M TELLING";
> }
> }
>
> -Sterling
>
That method suffers from the dictionary problem that Egan brought up.
--
Ignacio Vazquez-Abrams <ignacio@openservices.net>