which is best array_search or in_array?

前端 未结 7 1059
滥情空心
滥情空心 2020-12-23 20:17

I have a large while loop function, every time it gets loaded for check with current URL name. So I need to know which one is better to check the UR

7条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-23 20:43

    Based on the documentation of in_array and array_search, I'd think that it mainly depends on what you want to do with the information: if you need the entry, use array_search, if you just want to check if the url exists in the array, in_array should be enough.

提交回复
热议问题