RE: [PHP] word filter

From: Date: Mon, 01 Oct 2001 10:55:17 +0000
Subject: RE: [PHP] word filter
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-69437@lists.php.net to get a copy of this message
> There's a better way to do this: > > <? > $naughty_words = array( > 'poop', > 'bum', > 'religion' > ); > > echo in_array($text, $naughty_words) ? "found bad words!" : "text is > clean!"; > ?> This won't work, since you're trying to find the whole of $text in the array $naughty_words. -- Richard Heyes "I know not with what weapons World War III will be fought, but World War IV will be fought with sticks and stones." - Albert Einstein

« previous php.general (#69437) next »