title: Advanced Word Filter
body: <p>I really need a good bad word filter for my script. I already have an array of the bad words. But my problem was that it detected bad words in other words like say "test" was a bad word and you said "testing" it would still count it as a cuss word. On my second try i fixed the detect words in other words but people could bypass it etc by saying @test and 'cusswordhere'.</p>
  
  <p>Is there any thing i can do to fix this?</p>
  
  <p>My Code: </p>
  
  <pre><code>  function censor($message) {
              $badwords = $this-&gt;censor; //array containing bad words
              $message = @preg_replace('[^A-Za-z0-9 ]','',strtolower(' '.$message.' '));
              foreach($badwords as $bad) {
                  $bad = trim($bad);
                  if(strpos($message.' ', $bad.' ')!==false) {
                      if(strlen($bad)&gt;=2) {
                          return true;
                      }
                  }   
              }
  
      }
  </code></pre>
  
  <p>Currently it doesn't detect words in other words but you can bypass it by saying stuff like @cusshere  "cusshere" etc, is there anything i can do to fix this?</p>