I'm using the following sort of PHP script to replace certain things in a given text:
Now this works if someone enters "swear word" as name4. But the problem is, it's case sensitive...If they enter "Swear Word", "SWEAR WORD", "SwEaR WoRd" etc...it doesn't pick it up.
So basically I need a preg_replace that takes no notice of case. Is it possible, or have I gone about it the wrong way?
Code:
$replacethis[1] = '/swear word/';
$withthis[1] = '****';
$replacethis[2] = '/different swear word/';
$withthis[2] = '****';
$name5 = preg_replace($replacethis, $withthis, $name4);
Now this works if someone enters "swear word" as name4. But the problem is, it's case sensitive...If they enter "Swear Word", "SWEAR WORD", "SwEaR WoRd" etc...it doesn't pick it up.
So basically I need a preg_replace that takes no notice of case. Is it possible, or have I gone about it the wrong way?






