Hosting Solutions
mobile_logo Table of Contents

Bad Word Filter Function and Harmful Character String Array Replace

Learn to build bad word or harmful character filter functions and data filtration systems for user input. We are using the str_ireplace() php function fed with arrays. <?php function badWordFilter($data){ $originals = array("douche","punch","damn"); $replacements = array("friend","love","wow"); $data = str_ireplace($originals,$replacements,$data); return $data; } $myData = "Hi douche, damn I want to punch you for a good cause!"; $cleaned = badWordFilter($myData); echo $cleaned; ?>

PHP Videos

Array Programming

Dynamic Grid Output Programming Array Data TutorialReplace Characters with Emoticon Icons Array TutorialRandom Array Items From Flat Text File Database TutorialBad Word Filter Function and Harmful Character String Array ReplaceFind Value in Array Search Needle in Haystack TutorialMultiple Files Simultaneous Upload Array Programming TutorialBrowser and Operating System Detect Array Script