PHP_student
Oct 10 2009, 09:22 PM
Can someone help me make a swear filter, that when a user says a bad word, their whole message gets replaced with [content deleted]
Jacob
Oct 11 2009, 02:14 AM
Have you tried google? Or reading the manual?
Perry
Oct 12 2009, 04:31 AM
swordz
Oct 12 2009, 08:49 AM
str_replace won't quite do it - it will only replace that part.
You could do a preg_replace('/^(.*)(badword1|badword2)(.*)$/i', '[content deleted]' or you also do if(preg_match('/(badword1|badword2)/i'...) > 0) $message = '[content deleted';
swordz
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.