I am working and a function that censors words and I have come across a problem. In my little program, if some one types in the work "arse", it's replaced with asterisks. It words well, accepted when the word "arse" appear in another word like "rehearsed". It seems that when you type in "rehearsed" "rehe****d" is returned. Clearly this is not what I want
Question
AshMan
Hello.
I am working and a function that censors words and I have come across a problem. In my little program, if some one types in the work "arse", it's replaced with asterisks. It words well, accepted when the word "arse" appear in another word like "rehearsed". It seems that when you type in "rehearsed" "rehe****d" is returned. Clearly this is not what I want
Here is my code:
$str = eregi_replace("arse","<B>****</B>",$str);
Can anyone advise how to avoid this problem?
Link to comment
Share on other sites
4 answers to this question
Recommended Posts