Description
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.
Explanation & Answer
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.
array_search(value,array,strict)
Strict is optional. If this is set to TRUE, then this function will be
search for identical elements in the array. Possible values are:
• true
• false – Default
Review
Review
24/7 Homework Help
Stuck on a homework question? Our verified tutors can answer all questions, from basic math to advanced rocket science!
Similar Content
Related Tags
The Atlantis Gene
by S. A. Beck
Shattered - Inside Hillary Clintons Doomed Campaign
by Amie Parnes and Jonathan Allen
Their Eyes Were Watching God
by Zora Neale Hurston
The Second Sex
by Simone de Beauvoir
Things That Matter
by Charles Krauthammer
The Bell Jar
by Sylvia Plath
Fools Crow
by James Welch
The Subtle Art of Not Giving a F*ck
by Mark Manson
The Good Earth
by Pearl S. Buck