|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2010-08-03 18:17 UTC] + at ni-po dot com
Description:
------------
The appendix token documentation for T_STRING implies a bad programming style. As an example it gives `"$a[a]"`. According to the PHP documentation this is incorrect syntax, the correct one is `"$a['a']"` (which would result in a T_CONSTANT_ENCAPSED_STRING, not T_STRING.) `"$a[a]"` works, but only throwing a notice.
Furthermore all the other uses of this allrounder-token are not mentioned (e.g. for function, class and method names, constant names, ..., ...)
Proposed text:
<row>
<entry><constant>T_STRING</constant></entry>
<entry>identifier</entry>
<entry>identifier, e.g. function or class name</entry>
</row>
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 19 22:00:02 2025 UTC |
salathe is perfectly right (in all points). I didn't realize, that "$a[a]" is valid within a string. (Actually I had my thoughts on the complex variable syntax "{$a[a]}" there it *would* be a notice.) I am sorry for that. But the point about not mentioning identifiers like class and function name is still valid. <row> <entry><constant>T_STRING</constant></entry> <entry>"$a[a]", identifier</entry> <entry>string array index inside string or identifier, e.g. function or class name</entry> </row>Better turn it round or it is ambiguous (array index inside identifier one could think): <row> <entry><constant>T_STRING</constant></entry> <entry>identifier, "$a[a]"</entry> <entry>identifier ( e.g. function or class name) or string array index inside string</entry> </row>