> // example #1: in the script the text in the variable $guestbook does not > get replaced. > <? > $dirty_words = array("badword1","badword2","badword3"); > $guestbook = stripslashes($message); > foreach ($dirty_words as $word){ > $message = str_replace($word, "****", $guestbook); > } > echo $message; > ?> > ............................. >
this won't help your script work, but will tidy it up, but try using a regular expression... $dirty_words = array("|badword1|i","|badword2|i","|badword3|i"); //the i will make it case insensetive, which is extra useful... $message = preg_replace( $dirty_words, "****", stripslashes($message) ); echo $message; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php