Bug #71614 [Opn]: echo "${str{1}}"; raises syntax error

From: Date: Wed, 17 Feb 2016 09:57:53 +0000
Subject: Bug #71614 [Opn]: echo "${str{1}}"; raises syntax error
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-199295@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:         nikic@php.net
 Reported by:        yohgaki@php.net
 Summary:            echo "${str{1}}"; raises syntax error
 Status:             Open
 Type:               Bug
 Package:            Scripting Engine problem
 Operating System:   irrelevant
 PHP Version:        Irrelevant
 Block user comment: N
 Private report:     N

 New Comment:

This "bug" is best solved by deprecating the ${} interpolation syntax for non-expressions.


Previous Comments:
------------------------------------------------------------------------
[2016-02-17 04:34:32] yohgaki@php.net

Description:
------------
Both ${var} and {$var} are supposed to work, but ${$var} raises syntax error.

Test script:
---------------
php > $str = 'abc';

php > echo "${str{1}}";
PHP Parse error:  syntax error, unexpected '{' in php shell code on line 1

php > echo "{$str{1}}";
b



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



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


Thread (4 messages)

« previous php.bugs (#199295) next »