November 2002
Intermediate to advanced
640 pages
16h 33m
English
You want to know if an array contains a certain key.
Use isset( )
:
if (isset($array['key'])) { /* there is a value for 'key' in $array */ }You can check the definedness of an array element just as you’d for any other variable. See the Introduction to Chapter 5 for more information about the truth value of variables.
Documentation on isset( ) at
http://www.php.net/isset.
Read now
Unlock full access