array_search() function will return key of searched value in given array.
Example 1
$a=array("a"=>"cat","b"=>"dog","c"=>"monkey"); echo array_search("cat",$a);
Output:
a
Syntax:
array_search(value,array,strict)
Parameter and its description
value: Required: search value in array
array: Required: given array
strict: Optional: default value is false.
When value is true then it will check type of value.
Example 2
$a=array("a"=>"2","b"=>2,"c"=>"2"); echo array_search(2,$a,true);
Output:
b
#ThikHai