How to search Array for multiple values in PHP?

后端 未结 5 1302
滥情空心
滥情空心 2020-12-03 13:58

I need to get the keys from values that are duplicates. I tried to use array_search and that worked fine, BUT I only got the first value as a hit.

I need to get both

5条回答
  •  不思量自难忘°
    2020-12-03 14:10

    In array_search() we can read:

    If needle is found in haystack more than once, the first matching key is returned. To return the keys for all matching values, use array_keys() with the optional search_value parameter instead.

提交回复
热议问题