Your basic problem is that when you loop, you're not catching all the possible bad words. You need to read the string varible into a new variable and loop through the new copy of the original string. Try the following, it worked for me when I hacked your code a bit:
<?
$string = "this is a poo site and I think that it is boo and raa so there";
$replaced_string = $string;
//define array of bad words
$array_bad_words = array("poo","boo","raa");
//count the number of elements in the array
$num_elements = count($array_bad_words);
//for amount of elements replace bad words
for ($i = 1; $i < $num_elements; $i++) {
$replaced_string = ereg_replace("$array_bad_words[$i]","#@*&%",$replaced_string);
}
echo"Original: $string<P>";
echo"Replaced: $replaced_string";
?>
Hope this helps.......
Cheers,
Geoff
www.mithril.com