Page 1 of 1

Will this find and replace bad words:

Posted: Wed Jun 21, 2006 12:00 pm
by tecktalkcm0391

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 am just checking this will this find and replace badwords, in something like
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.

Posted: Wed Jun 21, 2006 12:05 pm
by feyd
Can you explain why this needed a new thread?