note 44012 deleted from function.array-key-exists by tomsommer
| From: | tomsommer@php.net | Date: | Mon, 12 Jul 2004 16:19:57 +0000 |
| Subject: | note 44012 deleted from function.array-key-exists by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-73106@lists.php.net to get a copy of this message | ||
Note Submitter: collectours@free.fr
----
Be careful :
array_key_exists($key, $array)
is _NOT_ equivalent to
isset($array($key))
Example :
If $array is a database row populated with a
mysql_fetch_array($res,MYSQL_ASSOC), and the database field 'key' has a NULL value
(returned by the database),
$array['key'] will exist with a value set to NULL.
isset( $array['key']) will be FALSE;
but
array_key_exists('key', $array) will be TRUE;
HTH
Pascal