bad word filter through txt file
<p>I am trying to use bad words filter but I want to load the bad words from a txt file on my server but some how failed to do so.here is my bad words filter code </p>

<pre><code>function badWordFilter(&amp;$text, $replace)
{
$patterns = array(
    '/butt/i',
    '/poop/i',
    '/crap/i'
);

$replaces = array(
    'b***',
    'p***',
    'c***'
);

$count = 0;
if($replace){
    $text = preg_replace($patterns, $replaces, $text, -1, $count);
} else {
    foreach($patterns as $pattern){
        $count = preg_match($pattern, $text);
        if($count &gt; 0){
            break;
        }
    }
}

return $count;
}

$any=BadWordFilter($qtitle,0);
$any=BadWordFilter($qtitle,1);
</code></pre>

<p>now to load the badwords from txt file I am using the following</p>

<pre><code>$file_array = file('/path/to/badword.txt'); 
$patterns = array(); 
foreach ($file_array as $word_combo) 
{ 
$patterns[] = explode(',', $word_combo); 

} 
</code></pre>

<p>but it gave me delimiter error </p>
