ID: 27181
Updated by: [EMAIL PROTECTED]
Reported By: admin at kcfreepress dot com
Status: Bogus
Bug Type: Documentation problem
Operating System: n/a
PHP Version: Irrelevant
New Comment:
Using quotes only leads to parse errors in strings when not using curly
braces, so "foo $array['bar']" would be incorrect, but that's the only
case you don't use quotes. Using "foo {$array["bar"]}" would be correct
again. See the manual page at http://php.net/types.string for further
reference.
Previous Comments:
------------------------------------------------------------------------
[2004-02-08 00:55:19] [EMAIL PROTECTED]
Thanks for your comments, but this is not the case. :)
In general, you must quote the keys used in array operations. If you
don't, you'll get a lot of notices when using E_ALL reporting mode.
(And you are using E_ALL, aren't you?)
So really, the ["key"] notation is correct. [key] is just a hack, and
shouldn't be used. ['key'], of course, would be best. =)
------------------------------------------------------------------------
[2004-02-07 23:18:18] admin at kcfreepress dot com
Description:
------------
Quoted from the PHP Manual (CHM file version, generated: Sun Oct 05
02:13:52 2003)
----------
Example 2-7. Printing data from our form
Hi <?php echo $_POST["name"]; ?>.
You are <?php echo $_POST["age"]; ?> years old.
----------
In order to avoid parse errors, it seems like this should instead
read:
----------
Example 2-7. Printing data from our form
Hi <?php echo $_POST[name]; ?>.
You are <?php echo $_POST[age]; ?> years old.
----------
Thanks!
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=27181&edit=1