Bug #71614 [NoF->ReO]: echo "${str{1}}"; raises syntax error

From: Date: Sun, 28 Feb 2016 21:46:47 +0000
Subject: Bug #71614 [NoF->ReO]: echo "${str{1}}"; raises syntax error
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-13223@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71614&edit=1 ID: 71614 Updated by: yohgaki@php.net Reported by: yohgaki@php.net Summary: echo "${str{1}}"; raises syntax error -Status: No Feedback +Status: Re-Opened Type: Bug Package: Documentation problem Operating System: irrelevant PHP Version: Irrelevant Block user comment: N Private report: N New Comment: Document should be more precise about variable and name resolution. Reopened. Previous Comments: ------------------------------------------------------------------------ [2016-02-28 04:22:26] php-bugs at lists dot php dot net 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 "Re-Opened". Thank you. ------------------------------------------------------------------------ [2016-02-19 05:53:00] yohgaki@php.net Thanks. I didn't think of $$. We may improve the doc http://jp2.php.net/manual/en/language.types.string.php {$} for variable expression, ${} for variable name resolution and few more examples invalid expressions. ------------------------------------------------------------------------ [2016-02-18 23:07:50] stas@php.net Not sure I understand - where's the bug in here and what would you expect to happen? str{1} is not a valid token for variable name, and is not a valid string offset operation since str is not variable - $str is. ------------------------------------------------------------------------ [2016-02-18 03:54:26] yohgaki@php.net @nikic Deprecating ${} is possible resolution. One concern is ${} is common in shell scripting languages. https://www.gnu.org/software/bash/manual/bashref.html ------------------------------------------------------------------------ [2016-02-17 09:57:52] nikic@php.net This "bug" is best solved by deprecating the ${} interpolation syntax for non-expressions. ------------------------------------------------------------------------ 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 https://bugs.php.net/bug.php?id=71614 -- Edit this bug report at https://bugs.php.net/bug.php?id=71614&edit=1

« previous php.doc.bugs (#13223) next »