#21814 [Asn->Csd]: false array keys
| From: | iliaa@php.net | Date: | Wed, 22 Jan 2003 14:49:13 +0000 |
| Subject: | #21814 [Asn->Csd]: false array keys | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-30923@lists.php.net to get a copy of this message | ||
ID: 21814
Updated by: iliaa@php.net
Reported By: philip@cornado.com
-Status: Assigned
+Status: Closed
Bug Type: Scripting Engine problem
Operating System: linux
PHP Version: 4CVS-2003-01-22 (stable)
Assigned To: iliaa
New Comment:
This bug has been fixed in CVS.
In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.
In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2003-01-22 03:30:25] philip@cornado.com
One can create a key as integer 0 and access it with key boolean false
but one cannot create an array with boolean false as the key. In
otherwords:
$arr = array(false => 'bar'); // array()
$arr = array((int)false => 'bar'); // array(0=>'bar')
$arr = array(0 => 'bar');
print $arr[false]; // bar
print $arr[(int)false]; // bar
This seems inconsistent. From the documentation:
Using TRUE as a key will evalute to integer 1 as key. Using FALSE as a
key will evalute to integer 0 as key.
Please explain the reasoning behind the current behavior.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=21814&edit=1