Loading…

What is the use of array_search() in php?

array_search() is a inbuilt function of PHP which is used to search a particular value in an array and if the value is found then it returns its corresponding its key.

Example

                                        

$array = array("1"=>"My", "2"=>"Name", "3"=>"is", "4"=>"BestInterviewQuestion");
echo array_search("BestInterviewQuestion",$array);

// OUTPUT 4

Suggest An Answer

No suggestions avaliable!

Latest post from PHP Arrays

Ask Question