1.

What is the use of array_search() in php?

Answer»

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



Discussion

No Comment Found