Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

array_simple_search

Hyomoto edited this page Jun 13, 2021 · 2 revisions
Jump To Go Back Arguments

array_simple_search( array, value, *func )

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

Arguments

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

Clone this wiki locally