$m = "ass"; $m = preg_replace("[^ass$]", "***", $m); echo $m; // output = *** $b = "basset"; $b = preg_replace("[^ass$]", "***", $<img src='http://www.pixel2life.com/forums/public/style_emoticons/<#EMO_DIR#>/shades.gif' class='bbc_emoticon' alt='B)' />; echo $b; // output = basset
this will check $m and $b for the word ass. If there is anything before, or after the word ass like asset, it will produce basset rather than ***et
So my question is, instead of having to do it like the example above, is there a way to do this in an array, check the array for the word, change the word if necessary?
Edited by derek.sullivan, 17 May 2011 - 11:30 AM.