Hey!
I'm just trying to replace some of the more bad words with their slightly 
censored counterparts like so

$bad_words = array(/*Well you know the words so am not going to write them 
here*/);
$bad_words_replacements = array("f*ck", "f*cking");
$comment = str_replace("$bad_words",$bad_words_replacements,  $comment);

My question is this, for just two words its fine to use the above, but a pal 
tells me that if using a lot of words (eg: 15) and the $comment is big then it 
can take quite some time and be a bit of a processing strain as well because 
php first checks the first word from the good list against all the 15 words in 
the bad list against the comment then moves to the second word etc.

Is this really bad processing wise and would you recommend any other way of 
doing this?
The other question i have is, wont "f*ck" catch "f*cking" as well? so should i 
delete the longer f*cking?

I'm not really trying to stop people swearing... just trying to make it not 
"jump out" so much, this was the poster is happy coz i have not censored him to 
bits and the reader should be a bit happy coz its a bit decent.

Thanks!
R


      

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to