<?php
function RpBadwords($string,$strfilter="***") {
GLOBAL $badwords;
$badlist=explode(",",$badwords);
$nn=count($badlist);
for ($i=0; $i<$nn; $i++) {
$string=str_replace($badlist[$i],$strfilter,$string);
}
return $string;
}
//Example
$badwords = "TNND,shit,SHIT,TMD";
$string = "TMD,真不象话,简直SHIT!";
echo RpBadwords($string);
?>