Re: Array Key Test

From: Date: Mon, 12 Jan 2004 17:18:16 +0000
Subject: Re: Array Key Test
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-174348@lists.php.net to get a copy of this message
Cameron B. Prince wrote:
Hi, How would I go about determining if a specific key exists in an array? I want to see if $conf['hOpt'] is defined. is_array only works at the $conf level.
You want: if(isset($conf['hOpt'])) { ... } You should always use isset to check if a variable is set, whether it is a straight variable, an array index, or an object member. -- paperCrane <Justin Patrin>

« previous php.general (#174348) next »