← All docs
array_search()
Searches the array for a given value and returns the first corresponding key if successful.
array_search()
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), defaultfalse, optional
Returns: mixed
Availability
- Compiled (AOT): supported by the Elephc code generator.
eval()(magician interpreter): supported — declarative interpreter builtin (crates/elephc-magician/src/interpreter/builtins/array/array_search.rs).
No examples yet — check examples/ and showcases/ for usage patterns.
Internals
For how array_search is implemented in the compiler, see the internals page.