Jump to content

help with preg_replace


helraizer

Recommended Posts

Hi folks,

 

I have a piece of code:

 

$dirty = array('bad words here', 'more bad words here', 'this is another bad word');
foreach($dirty AS $bad_word){
                        $text = preg_replace("/$bad_word/i","****", $text);
                        }    

 

Which works fine but how would I do it so that instead of replacing it with **** it merely gets rid of it completely?

 

Hope that makes sense,

Sam

Link to comment
https://forums.phpfreaks.com/topic/78560-help-with-preg_replace/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.