php man page for array_key_exists

Query: array_key_exists

OS: php

Section: 3

Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar

ARRAY_KEY_EXISTS(3)							 1						       ARRAY_KEY_EXISTS(3)

array_key_exists - Checks if the given key or index exists in the array

SYNOPSIS
bool array_key_exists (mixed $key, array $array)
DESCRIPTION
array_key_exists(3) returns TRUE if the given $key is set in the array. $key can be any value possible for an array index.
PARAMETERS
o $key - Value to check. o $array - An array with keys to check.
RETURN VALUES
Returns TRUE on success or FALSE on failure.
EXAMPLES
Example #1 array_key_exists(3) example <?php $search_array = array('first' => 1, 'second' => 4); if (array_key_exists('first', $search_array)) { echo "The 'first' element is in the array"; } ?> Example #2 array_key_exists(3) vs isset(3) isset(3) does not return TRUE for array keys that correspond to a NULL value, while array_key_exists(3) does. <?php $search_array = array('first' => null, 'second' => 4); // returns false isset($search_array['first']); // returns true array_key_exists('first', $search_array); ?>
NOTES
Note For backward compatibility, the following deprecated alias may be used: key_exists(3) Note For backward compatibility reasons, array_key_exists(3) will also return TRUE if $key is a property defined within an object given as $array. This behaviour should not be relied upon, and care should be taken to ensure that $array is an array. To check whether a property exists in an object, use property_exists(3).
SEE ALSO
isset(3), array_keys(3), in_array(3), property_exists(3). PHP Documentation Group ARRAY_KEY_EXISTS(3)
Related Man Pages
usort(3) - php
seekableiterator(3) - php
empty(3) - php
wincache_ucache_add(3) - php
wincache_ucache_delete(3) - php
Similar Topics in the Unix Linux Community
PHP problem
PHP: Search Multi-Dimensional(nested) array and export values of currenly worked on array.
How to check for values in array?
Output checker setting variable to TRUE or FALSE
PHP: declared variables, strlen vs isset