darklight Posted September 11, 2007 Share Posted September 11, 2007 I'm trying to replace a word but it replaces all the words. I'm basically trying to block bad words. Yes, I did ask for help about this before but still never found out how to do it . $Bad = array('fuck','shit','porn', 'pussy','cock','dick', 'sex','nigger','cunt', 'ass','drblock','dr-block', 'sucks','suck','crap', 'pron','anal','cornhole', 'butthole','asshole','tit'); $request = ucwords(strip_tags(str_replace($_POST['textfield3'],'$Bad','panda'))); Quote Link to comment https://forums.phpfreaks.com/topic/68891-solved-str_replace-help/ Share on other sites More sharing options...
Jessica Posted September 11, 2007 Share Posted September 11, 2007 Don't put single quotes around strings which have a variable. $request = ucwords(strip_tags(str_replace($_POST['textfield3'],$Bad,'panda'))); Quote Link to comment https://forums.phpfreaks.com/topic/68891-solved-str_replace-help/#findComment-346263 Share on other sites More sharing options...
darklight Posted September 11, 2007 Author Share Posted September 11, 2007 Still don't seem to work. Quote Link to comment https://forums.phpfreaks.com/topic/68891-solved-str_replace-help/#findComment-346265 Share on other sites More sharing options...
sasa Posted September 11, 2007 Share Posted September 11, 2007 try $request = ucwords(strip_tags(str_replace($Bad,'panda',$_POST['textfield3']))); Quote Link to comment https://forums.phpfreaks.com/topic/68891-solved-str_replace-help/#findComment-346270 Share on other sites More sharing options...
darklight Posted September 11, 2007 Author Share Posted September 11, 2007 Thank you! Quote Link to comment https://forums.phpfreaks.com/topic/68891-solved-str_replace-help/#findComment-346306 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.