Home > Backend Development > PHP Tutorial > php-Arrays function-array_key_exists-checks whether the given key name or index exists in the array_PHP tutorial

php-Arrays function-array_key_exists-checks whether the given key name or index exists in the array_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-13 17:51:00
Original
807 people have browsed it

array_key_exists() checks whether the given key name or index exists in the array

【Function】
This function will return a Boolean value,
​​​​If the specified key exists in the specified array, it returns true, otherwise it returns false
At the same time, this function can also be used for objects, that is, to check whether the specified key is in the object
【Scope of use】
​​​​​ php4>4.1.0, php5.
【Use】
           bool array_key_exists(mixed key,array search)
          key/required/key name
           search/required/search array
【Example】
[php]
$search_array = array('first'=>1,'second'=>4);
if(array_key_exists('first',$search_array)){
echo "The 'first' element is in the array";
}
/*
The 'first' element is in the array
*/

Excerpted from zuodefeng’s notes

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/478212.htmlTechArticlearray_key_exists() Check whether the given key name or index exists in the array [Function] This function will return a Boolean value, returned if the specified key exists in the specified array...
Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template