Will this find and replace bad words:
Posted: Wed Jun 21, 2006 12:00 pm
Code: Select all
<?php
$text='I have a badword here and anabadwordhere';
$badwords = array();
$badwords[] = array(' where do you live', ' *!* ');
$badwords[] = array(' \@\$\$ ', ' *!* ');
$badwords[] = array(' a\$\$ ', ' *!* ');
foreach ($badwords as $badword) {
$text = eregi_replace($badword[0],$badword[1],$text);
}
return trim($text);
}
?>I have a badword here and anabadwordhere
if badword was a badword would it find it in both places or only the first badword?
Thanks.