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.

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

Oficiální dokumentace funkce array-search

AI konzultace & implementace

Pomohu vám zavést AI do vašeho projektu– od analýzy a návrhu řešení až po nasazení do produkce. Ušetřete čas, zjednodušte procesy a získejte konkurenční výhodu.

Domluvit konzultaci
Konzultant: Jan Barášek
Potřebujete poradit s PHP?

Nabízím trénink vývojářů, konzultace, školení a analýzu návrhových vzorů. Osobně v Praze nebo online.

Napište mi

Newsletter

Nejlepsi tipy a triky o PHP do Vaseho e-mailu. Clanky a novinky nejen ze sveta PHP a programovani.