English [sɜ:tʃ] US [sɜ:rtʃ]
##v. Search; search, search; investigate; explore n. Search; investigate; explore Third person singular: search Present participle: searching Past tense: search Past participle: searchphp array_search() function syntax
Function:Search for a key value in the array and return the corresponding key name.
Syntax:array_search(value,array,strict)
Parameters:
Parameter | Description |
value | Required. Specifies the key value to be searched. |
array | Required. Specifies the array to be searched. |
strict | Optional. If this parameter is set to TRUE, the function searches the array for elements of the same data type and value. Possible values: true, false - default, if set to true, the type of the given value is checked in the array, the number 5 and the string 5 are different |
Description:Search for a key value in the array. If the value is found, the key name of the matching element will be returned. If not found, returns false.
php array_search() function example
"西门","b"=>"php中文网","c"=>"php.cn"); echo array_search("西门",$a); ?>
Run instance»
Click the "Run instance" button to view the online instance
Output:
a
"灭绝","2"=>"欧阳克","3"=>"php.cn"); echo array_search("欧阳克",$a); ?>
Run instance»
Click the "Run instance" button to view the online instance
Output:
2