How do you perform a preg_match where the pattern is an array, in php?

前端 未结 7 1396
予麋鹿
予麋鹿 2020-12-16 20:41

I have an array full of patterns that I need matched. Any way to do that, other than a for() loop? Im trying to do it in the least CPU intensive way, since I will be doing

7条回答
  •  星月不相逢
    2020-12-16 20:56

    If you're merely searching for the presence of a string in another string, use strpos as it is faster.

    Otherwise, you could just iterate over the array of patterns, calling preg_match each time.

提交回复
热议问题