note 90839 deleted from function.array-key-exists by danbrown
| From: | danbrown@php.net | Date: | Tue, 12 May 2009 14:42:30 +0000 |
| Subject: | note 90839 deleted from function.array-key-exists by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-154507@lists.php.net to get a copy of this message | ||
Note Submitter: s dot nerz at nospam dot orestes-sol dot com
----
@Gibson: Your array_key_exists will return a *false* value for some cases, where the array key
actually exists...
<?php
$foo = array('key' => FALSE);
if ( array_key_exists_nc('key', $foo) ) {
print "Key exists!";
} else {
print "Key does NOT exist!";
}
?>
will print "Key does NOT exist!" .. This is one of the fundamental differences between
isset and array_key_exists - and thus should (perhaps) not be changed ...