Question: Using PHP Write a function wordFilter ( $str ) that takes a string representing a sentence as a parameter. It should replace all occurrences of

Using PHP
Write a function wordFilter($str) that takes a string representing a sentence as a parameter. It should replace all occurrences of certain blacklisted words with asterisks of the same length and return the substituted sentence. The words shootdarn and fudge(case insensitive) are considered blacklisted. However, these words as part of a larger word should be left alone (e.g. overshoot is fine as it is). Use one or more regular expressions with replacements in your solutions (e.g. preg_replace).

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!