|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-09-22 21:01 UTC] akam at akameng dot com
[2008-09-22 22:11 UTC] tularis@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Dec 12 02:00:01 2025 UTC |
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