i need to know how to make a language filtering script. I'm developing a mail system and I want to keep the use of vulgar language restricted. My question is, how can i search for a certain value inside of a string. I realize I could put each individual word of the body into an array and then search each item of the array but that seems like taking the hard way out. any suggestions?$string = str_replace("cussword", "@#$!", $string);
you can also do an array
$cusswords = array("cuss1", "cuss2", "cuss3");
$string = str_replace($cusswords, "@#$!", $string);thanks
that would work, however it would be better if I didnt actually replace the word, rather just return some value true. like if a cuss word exists in a string, then it would return a value true, rather than replace the <!-- m --><a class="postlink" href="wordhttp://us4.php.net/manual/en/function.ereg.php">wordhttp://us4.php.net/manual/en/function.ereg.php</a><!-- m -->
or
<!-- m --><a class="postlink" href="http://us4.php.net/manual/en/function.strstr.php">http://us4.php.net/manual/en/function.strstr.php</a><!-- m -->
or
<!-- m --><a class="postlink" href="http://us4.php.net/manual/en/function.stripos.php">http://us4.php.net/manual/en/function.stripos.php</a><!-- m -->
you can also do an array
$cusswords = array("cuss1", "cuss2", "cuss3");
$string = str_replace($cusswords, "@#$!", $string);thanks
that would work, however it would be better if I didnt actually replace the word, rather just return some value true. like if a cuss word exists in a string, then it would return a value true, rather than replace the <!-- m --><a class="postlink" href="wordhttp://us4.php.net/manual/en/function.ereg.php">wordhttp://us4.php.net/manual/en/function.ereg.php</a><!-- m -->
or
<!-- m --><a class="postlink" href="http://us4.php.net/manual/en/function.strstr.php">http://us4.php.net/manual/en/function.strstr.php</a><!-- m -->
or
<!-- m --><a class="postlink" href="http://us4.php.net/manual/en/function.stripos.php">http://us4.php.net/manual/en/function.stripos.php</a><!-- m -->