#21814 [Opn->Asn]: false array keys
| From: | iliaa@php.net | Date: | Wed, 22 Jan 2003 14:41:59 +0000 |
| Subject: | #21814 [Opn->Asn]: false array keys | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-30922@lists.php.net to get a copy of this message | ||
ID: 21814
Updated by: iliaa@php.net
Reported By: philip@cornado.com
-Status: Open
+Status: Assigned
Bug Type: Scripting Engine problem
Operating System: linux
PHP Version: 4CVS-2003-01-22 (stable)
-Assigned To:
+Assigned To: iliaa
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