Codice PHP:
<?php
//load list of common words
$common = file('stopwords.txt');
$total = count($common);
for ($x=0; $x<= $total; $x++)
$common[$x] = trim(strtolower($common[$x]));
function stopWords($term)
{
global $common;
$term = ereg_replace("[[:punct:]]"," ",$term);
$_terms = explode(" ", $term);
foreach ($_terms as $line)
{
if (in_array(strtolower(trim($line)), $common))
$clean_term .= " XXXXX ";
else
$clean_term .= " ".$line;
}
return $clean_term;
}
$contatore = 0;
$textfile = fopen("public/bacheca/db/messaggi.txt", "r");
while ($rigafile = fgets($textfile,1024))
{
$campiriga = explode("|", $rigafile);
$messaggioCensurato= stopWords($campiriga[4]);
echo "- $campiriga[1]-$messaggioCensurato-[b]$campiriga[2][/b]
";
}
fclose($textfile);
?>
Avevo amici salentini 
Cosí dovrebbe andare, ricordati che in stopwords.txt ci devi mettere tutte le parole che non vuoi siano scritte nel formato :
Parola1
Parola2
Parola3
ok ?