ID: 46154 Updated by: [EMAIL PROTECTED] Reported By: akam at akameng dot com -Status: Open +Status: Bogus Bug Type: Scripting Engine problem Operating System: Windows XP SP2 PHP Version: 5.2.6 New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php as this bug system is not the appropriate forum for asking support questions. Due to the volume of reports we can not explain in detail here why your report is not a bug. The support channels will be able to provide an explanation for you. Thank you for your interest in PHP. This is completely expected. First of all, '' === "", seriously, there is 0 difference between those two. Next, I think you misunderstood the manual. It just says you CAN use an empty string, and it WILL work. If an empty string is already defined as a key, it will simply overwrite it. $test = array('zero' => '1', '' => '2', "" => '3' ); echo $test['zero']."\n<br />"; //outputs: 1 echo $test['']."\n<br />"; //outputs: 3 echo $test[""]."\n<br />"; //outputs: 3 '' = empty string "" = exact same empty string you could even use a heredoc to make such an empty string. They are all exactly the same. Read up on single and double quotes to find out how they differ. Previous Comments: ------------------------------------------------------------------------ [2008-09-22 21:01:01] akam at akameng dot com Actual result: -------------- php.net php.net php.net $key = zero and $value = php.net $key = and $value = php.net ------------------------------------------------------------------------ [2008-09-22 20:50:32] akam at akameng dot com Description: ------------ due to this line of php manual: "Using the empty string as a key will create (or overwrite) a key with the empty string and its value;" but empty string key will work. Reproduce code: --------------- <?php $test = array('zero' => 'php.net', '' => 'php.net', "" => 'php.net' ); //test echo $test['zero']."\n<br />"; //output: php.net echo $test['']."\n<br />"; //output: php.net echo $test[""]."\n<br />"; //output: php.net foreach ($test as $key => $value ){ echo "\$key = $key and \$value = $value \n<br />"; } //out put /* $key = zero and $value = php.net $key = and $value = php.net */ ?> Expected result: ---------------- php.net php.net Actual result: -------------- php.net php.net php.net php.net php.net ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=46154&edit=1