Hi, On Thu, Jan 29, 2015 at 11:32 PM, Yasuo Ohgaki <yohg...@ohgaki.net> wrote: > Hi all, > > I came across with bug #68947 https://bugs.php.net/bug.php?id=68947 > and realized small inconsistency. > > http://3v4l.org/ldZKl > > $obj->${array[$key]}; // Syntax error > $obj->{$array[$key]}; // Works > > $obj->${key}; // E_NOTICE. Does not work > $obj->{$key}; // Works > > echo "${array[$key]}"; // Works > echo "{$array[$key]}"; // Works > > Of course, script/string parsing aren't the same. Are there technical > reasons > why ${value} is not allowed? If there are, we may encourage > > echo "{$array[$key]}"; // Works > > rather than > > echo "${array[$key]}"; // Works >
Is somebody actually recommending the latter form? I'm surprised that it even works ... that should be a syntax error IMO. Cheers, Andrey. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php