← All docs

array_search()

Searches the array for a given value and returns the first corresponding key if successful.

function array_search(mixed $needle, array $haystack, bool $strict = false): mixed

Searches the array for a given value and returns the first corresponding key if successful.

Parameters:

  • $needle (mixed)
  • $haystack (array)
  • $strict (bool), default false, optional

Returns: mixed

No examples yet — check examples/ and showcases/ for usage patterns.

Internals

For how array_search is implemented in the compiler, see the internals page.