I've been wondering how I would alter a username of someone registering on a website to a completely different thing if it has bad words in it. I have something similar to this that goes like this:
$BadWords = array("badword1", "badword2", "badword3", "badword4", "badword5", "badword6", "badword7", "badword8", "badword9", "badword10", "badword11", "badword12", "badword13", "badword14", "badword15", "badword16", "badword17", "badword18", "badword19", "badword20", "badword21", "badword22", "badword23", "badword24", "badword25", "badword26", "badword27", "badword28", "badword29","badphrase" ,"badword30","badword31","badword32");
$Var = "[ContentRemoved]";
$title = str_replace($BadWords,$Var, $Username);
$Username = str_replace($BadWords,$Var, $Username);
The problem with this is that if someone enters a username such as "gobadword23" it will change it to "go[ContentRemoved]".
What I want it to do instead is replace the WHOLE username with "[ContentRemoved]". And not just the bad words.