preg_replace
Posted: Thu Apr 21, 2005 5:30 am
ok i have this running as a bad word filter
but i keep getting the error message
Warning: Delimiter must not be alphanumeric or backslash in /home/wesmok2/public_html/shizMsg/process.php on line 100
after it finds 1 match. what does that mean anyway? the string only contains letters and spaces.
d11wtq | Shiz, please read the sticky about posting code with line offsets
Code: Select all
$bad_file = file_get_contents('badwords.txt');
$bad_words = explode(',', $bad_file);
foreach($bad_words as $bad){
$bad = trim($bad);
$check = strpos($message, $bad);
if ($check != false){
$len = strlen($bad);
for($i=0; $i<$len; $i++){
$replace .= '*';
}
$message = preg_replace($bad, $replace, $message);
unset($replace);
}
}Warning: Delimiter must not be alphanumeric or backslash in /home/wesmok2/public_html/shizMsg/process.php on line 100
after it finds 1 match. what does that mean anyway? the string only contains letters and spaces.
d11wtq | Shiz, please read the sticky about posting code with line offsets