I have this basic profanity filter code;
$body = "This is a naughty word";
$filterWords = array('naughty', 'word');
$filterCount = sizeof($filterWords);
for($i=0; $i<$filterCount; $i++){
$body = preg_replace('/\b'.$filterWords[$i].'\b/ie',"str_repeat('*',strlen('$0'))",$body);
}
echo $body;
However it's not working, just outputs nothing. It used to work fine. Any idea where the error is?