Outline the differences between the value returned by the in_array() function and the array_search() function. Provide an example of a situation or scenario when each of these would be used.
in_array function searches an array for a
specific value. Just check it! Value exists in an array or not. (Use
only PHP4 or PHP5)
in_array(search,array,type)Type is optional.
If this parameter is set to TRUE, the in_array() function searches for
the search-string and specific type in the array.
array_search() function is used to search an array for a specified value, it then returns the key of a corresponding value.
Strict is optional. If this is set to TRUE, then this function will be
search for identical elements in the array. Possible values are:
• false – Default
Content will be erased after question is completed.
Enter the email address associated with your account, and we will email you a link to reset your password.
Forgot your password?