PHP Replacing swear words with phrases

前端 未结 4 1098
旧时难觅i
旧时难觅i 2021-01-17 02:18

So I get how to replace certain words with other ones. What I\'m trying to figure out is how to take a word and replace it with a phrase and eliminate all other input.

4条回答
  •  伪装坚强ぢ
    2021-01-17 03:01

    Heres an alternative solution, match words and replace with * len of str. this wont match words like Scunthorpe as it uses word boundaries, Also you you can add a 3rd param to reveal the first letters of the word so you know what word was said without seeing it.

    
    

提交回复
热议问题