Search an array for a matching string

前端 未结 7 1311
渐次进展
渐次进展 2021-01-23 01:26

I am looking for away to check if a string exists as an array value in an array is that possible and how would I do it with PHP?

7条回答
  •  终归单人心
    2021-01-23 02:07

    The array_search function does exactly what you want.

    $index = array_search("string to search for", $array);
    

提交回复
热议问题