-
Notifications
You must be signed in to change notification settings - Fork 2
array_simple_search
Hyomoto edited this page Jun 13, 2021
·
2 revisions
| Jump To | Go Back |
Arguments |
|---|
Returns: [mixed or ValueNotFound](mixed or ValueNotFound)
Throws: InvalidArgumentType
Searches for the first occurance of value in the array, and returns that position. You can override the function used for comparison by specifying func. If the value is not found, ValueNotFound will be returned. If an array is not provided to search, or a method is not provided for func InvalidArgumentType will be thrown.
array_simple_search([ 10, 20, 30, 40, 50 ], 30 );
Output: 2
| Name | Type | Purpose |
|---|---|---|
| array | [Array](array) |
The array to search |
| value | [Mixed](mixed) |
The value to find |
| *func | method |
optional: If provided, will be used for sake of comparison |
Devon Mullane 2020