📜  php代码示例中的array_search

📅  最后修改于: 2022-03-11 14:54:51.498000             🧑  作者: Mango

代码示例6
PHP function array_search(mixed $needle, array $haystack, bool $strict = false) false|int|string
---------------------------------------------------------------------------------------------
  
Searches the array for a given value and returns the first corresponding key if successful.
  
Parameters:
mixed--$needle--The searched value.If needle is a string, the comparison is done in a case-sensitive manner.
array--$haystack--The array.
bool--$strict--[optional] If the third parameter strict is set to true then the array_search function will also check the types of the needle in the haystack.
  
Returns: the key for needle if it is found in the array, false otherwise.
  
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.