PHP funkce array_search()
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.
Další zdroje
Jan Barášek Více o autorovi
Autor článku pracuje jako seniorní vývojář a software architekt v Praze. Navrhuje a spravuje velké webové aplikace, které znáte a používáte. Od roku 2009 nabral bohaté zkušenosti, které tímto webem předává dál.
Rád vám pomůžu:
Kontakt Spolupráce