PHP funkce array_search()
Dostupnost ve verzích: PHP 4.0.5
Searches the array for a given value and returns the corresponding key if successful
Parametry
| Parametr | Datový typ | Výchozí hodnota | Poznámka |
|---|---|---|---|
$needle |
mixed |
není | The searched value. |
$haystack |
array |
není | The array. |
$strict |
bool |
null | 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. |
Návratové hodnoty
mixed
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.