note 85881 added to language.types.array
| From: | akamatakamengdotcom at osu1 dot php dot net | Date: | Mon, 22 Sep 2008 19:57:34 +0000 |
| Subject: | note 85881 added to language.types.array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-144622@lists.php.net to get a copy of this message | ||
Discussing this line of manual:
"Using the empty string as a key will create (or overwrite) a key with the empty string and its
value;"
example:
<?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
*/
?>
I think using empty string is work, so either the manual should change or the array behavior.
----
Server IP: 69.147.83.197
Probable Submitter: 67.159.0.114
----
Manual Page -- http://www.php.net/manual/en/language.types.array.php
Edit -- https://master.php.net/note/edit/85881
Del: integrated -- https://master.php.net/note/delete/85881/integrated
Del: useless -- https://master.php.net/note/delete/85881/useless
Del: bad code -- https://master.php.net/note/delete/85881/bad+code
Del: spam -- https://master.php.net/note/delete/85881/spam
Del: non-english -- https://master.php.net/note/delete/85881/non-english
Del: in docs -- https://master.php.net/note/delete/85881/in+docs
Del: other reasons-- https://master.php.net/note/delete/85881
Reject -- https://master.php.net/note/reject/85881
Search -- https://master.php.net/manage/user-notes.php