PHP Code - How to Remove a Word or Words from String

PHP How to Remove Specific Words from a String with Simple PHP Function ie Remove Stop Words, Remove Swears etc

Home Short:

Use the function below to remove any words you wish from a string. [$txt] is the string you want to remove words from and [$word] is the word you want removed. If you want multiple words remove, create a loop removing each word, one at a time.

S
H
A
R
E