ID: 15677
Comment by: [EMAIL PROTECTED]
Reported By: [EMAIL PROTECTED]
Status: Open
Bug Type: Feature/Change Request
Operating System: *
PHP Version: 4.1.1
New Comment:
Actually, the open curly bracket is misplaced in the "correct" syntax.
Caused me about an hour's pain. OUCH!
Previous Comments:
------------------------------------------------------------------------
[2002-05-09 03:43:40] [EMAIL PROTECTED]
This is not the point, Yasou. Read the initial report.
Let Hartmut decide what to do with this.
------------------------------------------------------------------------
[2002-05-09 02:46:27] [EMAIL PROTECTED]
The correct syntax is
<?php echo "${arr['index']}"; ?>
I think it is documented, if not. Please feel free to reopen as
documentation problem.
------------------------------------------------------------------------
[2002-05-08 14:05:32] [EMAIL PROTECTED]
I would very much like to see this implemented soon. Since PHP has
said (at least in the manual) that it is trying to get away from
$array[index] syntax and into $array['index'] syntax, support for this
syntax directly in strings would help very much.
-Steve
------------------------------------------------------------------------
[2002-02-22 09:42:10] [EMAIL PROTECTED]
<?php echo "$array[index]"; ?>
works while
<?php echo "$array['index']"; ?>
gives
PHP Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or
`T_NUM_STRING' in - on line 1
the error message is not very helpfull (knowing the exact character
position in the line would help a little bit, but that's another story)
and the different syntax requirements for array indices within and
outside of strings are somtimes confusing for newbies, too
so "$array['index']" should be supported by the parser
PS: i know about "{$array['index']}", but that is not the point ...
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=15677&edit=1