QUOTE
Hi everybody i wrote bad word filter program i throws error
pls help me
thanks in Advace
CODE
<?
//echo "ajay";
class swearfilter
{
static $words = array("dirty","notgud","waste","bad","useless","handsome"
// TODO: Enter bad words here like so: "bad",
);
function replace($haystack)
{
// Set the replacements
$replacements = array("?", "!", "*", "@", "#", "*");
// Loop through each and every word in the $words array
foreach(swearfilter::$words as $needle)
{
$replace = '';
// Create our replacement string by string length
for($i=0; $i<strlen($needle); $i++)
{
$radnum = rand(0, 5);
$replace .= $replacements[$radnum];
}
// Search for the current word and replace
$haystack = str_ireplace($needle, $replace, $haystack);
}
// Return the "clean" text
return $haystack;
print_r($words);
}
}
?>