note 30132 added to language.types.array
| From: | php-general at lists dot php dot net | Date: | Fri, 07 Mar 2003 09:28:26 +0000 |
| Subject: | note 30132 added to language.types.array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-44973@lists.php.net to get a copy of this message | ||
"Using NULL as a key will evaluate to an empty string. Using an emptry string as key will
create (or overwrite) a key with an empty string and its value, it is not the same as using empty
brackets."
If you create an array like this:
$foo = array(null => 'bar');
And then want to access 'bar', you must use this syntax:
echo $foo['']; // notice the two single quotes
This will of course cause a fatal error:
echo $foo[];
--
http://www.php.net/manual/en/language.types.array.php
http://master.php.net/manage/user-notes.php?action=edit+30132
http://master.php.net/manage/user-notes.php?action=delete+30132
http://master.php.net/manage/user-notes.php?action=reject+30132