PHP - Find if any of the keywords in an array exist in a string

前端 未结 5 1698
死守一世寂寞
死守一世寂寞 2021-02-06 19:32

Basically, I have an array of keywords, and a piece of text. I am wondering what would be the best way to find out if any of those keywords are present in the text, bearing in m

5条回答
  •  生来不讨喜
    2021-02-06 20:28

    You could dump the text into an array and do a array_intersect_key on the two arrays. I am not sure of the performance of this though...

提交回复
热议问题