note 83500 added to function.array-key-exists

From: Date: Wed, 28 May 2008 17:29:48 +0000
Subject: note 83500 added to function.array-key-exists
Groups: php.notes 
Request: Send a blank email to php-notes+get-139955@lists.php.net to get a copy of this message
You'll notice several notes on this page stating that isset() is significantly faster than array_key_exists(). This may be true except for one small hitch. isset() will return false for arrays keys that have there value set to NULL, which is therefore not entirely accurate. Example: <?php $foo = array(); $foo['bar'] = NULL; var_dump(isset($foo['bar'])); var_dump(array_key_exists('bar', $foo)); ?> will output: bool(false) bool(true) Be aware of this! ---- Server IP: 208.69.120.35 Probable Submitter: 68.167.57.122 ---- Manual Page -- http://www.php.net/manual/en/function.array-key-exists.php Edit -- https://master.php.net/note/edit/83500 Del: integrated -- https://master.php.net/note/delete/83500/integrated Del: useless -- https://master.php.net/note/delete/83500/useless Del: bad code -- https://master.php.net/note/delete/83500/bad+code Del: spam -- https://master.php.net/note/delete/83500/spam Del: non-english -- https://master.php.net/note/delete/83500/non-english Del: in docs -- https://master.php.net/note/delete/83500/in+docs Del: other reasons-- https://master.php.net/note/delete/83500 Reject -- https://master.php.net/note/reject/83500 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#139955) next »