PHP function to check for banned words

前端 未结 1 1159
别那么骄傲
别那么骄傲 2021-01-16 03:43

I have this function to check for banned words in my string. However, I cannot detect banned words if the spaces are removed - rendering the function useless. Can someone he

相关标签:
1条回答
  • 2021-01-16 04:31

    \b detects word boundaries, remove them to get a regular match.

    "/(" . implode("|", $badWords) . ")/i", 
    
    0 讨论(0)
提交回复
热议问题