Help - Search - Members - Calendar
Full Version: Swear Filter?
Zymic Webmaster Forums > Web Design & Development > Server Side Scripting > PHP
PHP_student
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
Have you tried google? Or reading the manual?
Perry
str_replace

Try that wink.gif
swordz
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.
Invision Power Board © 2001-2012 Invision Power Services, Inc.