note 68619 added to function.array-key-exists
| From: | MikeToppa at osu1 dot php dot net | Date: | Thu, 03 Aug 2006 17:43:56 +0000 |
| Subject: | note 68619 added to function.array-key-exists | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-115521@lists.php.net to get a copy of this message | ||
At least in PHP 4.4.0, array_key_exists is inconsistently sensitive to different data types. For
example, if your first argument is a double and the keys in your array are integers,
array_key_exists will always return false. If you then cast the first argument to an integer, or
even to a string, then you can successfully match. I haven't tested all the possibilities, to
see when it'll tolerate different data types and when it won't, so the easiest and safest
solution is to cast your first argument to match the data type of the keys.
----
Server IP: 66.163.161.117
Probable Submitter: 130.91.13.51
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.array-key-exists.php
Edit -- https://master.php.net/note/edit/68619
Del: integrated -- https://master.php.net/note/delete/68619/integrated
Del: useless -- https://master.php.net/note/delete/68619/useless
Del: bad code -- https://master.php.net/note/delete/68619/bad+code
Del: spam -- https://master.php.net/note/delete/68619/spam
Del: non-english -- https://master.php.net/note/delete/68619/non-english
Del: in docs -- https://master.php.net/note/delete/68619/in+docs
Del: other reasons-- https://master.php.net/note/delete/68619
Reject -- https://master.php.net/note/reject/68619
Search -- https://master.php.net/manage/user-notes.php