← All built-ins / array_search()
array_search()
array_search(...$args): mixed
Parameters
| Name | Type | Description |
|---|---|---|
| $needle | mixed | value to find |
| $haystack | array | array to search |
Return value
The key of the first match, or false when not found.
Example
echo array_search(20, [10, 20, 30]);
1