Whitespace inside of { } should not matter, the contents should be evaluated as an expression and it's results used to determine the variable name, so ${great} should also be $my as in the other cases.
Is this related to the use of quotes around string array keys inside strings? e.g. "$foo[great]" does not evaluate to $foo['my'] but to $foo['great']. - Davey On Tue, Apr 12, 2016 at 8:08 PM, Sara Golemon <poll...@php.net> wrote: > I'm trying to decide just whether or not > https://bugs.php.net/bug.php?id=71927 is "working as intended" as well > as what the expected behavior in this situation /should/ be. > > https://3v4l.org/HfU1g indicates that at the very least HHVM and PHP > disagree on the correct output, and testing the same sort of > expression in bash says that it's not having any of it; "invalid > substitution" warnings abound. > > The PHP behavior is just kinda weird. "${ great}" does constant > interpolation yielding "$my" which in turn becomes variable > interpolation and we find up with "my value". I'm actually doubtful > that PHP pulls off this juggling *by accident*, which is why I'm > posting about it before even going to the extent of proposing an RFC. > > Does anyone have historical context on this and can explain the > current behavior as "working as intended"? > > -Sara > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php >