ID:               20601
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
 Status:           Open
 Bug Type:         Documentation problem
 Operating System: Windows ME
 PHP Version:      4.3.0RC1
 Assigned To:      philip
 New Comment:

Philip, please do not change that part of the documentation. **It is
correct!**.

Try with this script:

<?php

error_reporting(E_ALL);
ini_set("display_errors", TRUE);

$arr['foo'][3] = 14;

echo "This is wrong: {$arr[foo][3]}";
echo "This is good: {$arr['foo'][3]}";

?>

For the first echo line, a NOTICE error is
echoed out... So the documentation is correct. It may not be clear
enough, but it is correct, the example is right.


Previous Comments:
------------------------------------------------------------------------

[2002-12-05 13:49:27] [EMAIL PROTECTED]

As it turns out, the string docs are wrong and contain the following in
the example:


// This is wrong for the same reason
// as $foo[bar] is wrong outside a string. 
echo "This is wrong: {$arr[foo][3]}";


I'll rewrite this part of the documention too.  $foo[bar] is perfectly
fine inside strings, CONSTANTS aren't seen in strings.  Anyway, this
will be further explained with a more specific example too.  And a faq
entry :)  This question comes up waaaaaaay too much these days.

------------------------------------------------------------------------

[2002-12-05 13:26:22] [EMAIL PROTECTED]

The string type description includes a lengthy explanation of this
AFAIK.

------------------------------------------------------------------------

[2002-12-04 19:03:14] [EMAIL PROTECTED]

Btw, this happens when you do:

print "a foo $bar['blah'] eh";

Don't do that.  You can do either:

print "a foo {$bar['blah']} eh";
print "a foo $bar[blah] eh";
print "a foo " . $bar['blah'] . " eh";

But when outside of strings always quote your keys:

print $bar[blah];   // bad
print $bar['blah']; // good

Unless of course you defined blah as a constant earlier.  Anyway I'm
making a faq out of this question and marking as a doc bug because this
question comes up a lot especially since 4.1.0 (autoglobals) and 4.2.0
(register_globals default change).

------------------------------------------------------------------------

[2002-12-04 18:17:54] [EMAIL PROTECTED]

No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.



------------------------------------------------------------------------

[2002-11-23 14:05:03] [EMAIL PROTECTED]

Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php

If you can provide more information, feel free to add it
to this bug and change the status back to "Open".

Thank you for your interest in PHP.


can you include a short script?

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/20601

-- 
Edit this bug report at http://bugs.php.net/?id=20601&edit=1


-- 
PHP Documentation Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to