Re: [PHP-DEV] Use of {} with member.

2015-01-29 Thread Yasuo Ohgaki
Hi all, On Fri, Jan 30, 2015 at 8:51 AM, Rasmus Lerdorf wrote: > On 01/29/2015 01:32 PM, Yasuo Ohgaki 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]}; /

Re: [PHP-DEV] Use of {} with member.

2015-01-29 Thread Rasmus Lerdorf
On 01/29/2015 01:32 PM, Yasuo Ohgaki 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. D

Re: [PHP-DEV] Use of {} with member.

2015-01-29 Thread Andrey Andreev
Hi, On Fri, Jan 30, 2015 at 12:49 AM, Yasuo Ohgaki wrote: > Hi Andrea, > > On Fri, Jan 30, 2015 at 7:17 AM, Andrea Faulds wrote: >> >> I would expect that anything within ${} works the same as it does outside >> it. Having $obj->${array[$key]} do something different to $key = >> array[$key], $ob

Re: [PHP-DEV] Use of {} with member.

2015-01-29 Thread Yasuo Ohgaki
Hi Andrea, On Fri, Jan 30, 2015 at 7:17 AM, Andrea Faulds wrote: > I would expect that anything within ${} works the same as it does outside > it. Having $obj->${array[$key]} do something different to $key = > array[$key], $obj->${$key} would make no sense to me. Good point! I forgot about var

Re: [PHP-DEV] Use of {} with member.

2015-01-29 Thread Andrea Faulds
Hi Yasuo, > On 29 Jan 2015, at 22:14, Yasuo Ohgaki wrote: > > Hi Andrey, > > On Fri, Jan 30, 2015 at 6:43 AM, Andrey Andreev wrote: >> >> Is somebody actually recommending the latter form? I'm surprised that >> it even works ... that should be a syntax error IMO. > > > Do you mean > > echo

Re: [PHP-DEV] Use of {} with member.

2015-01-29 Thread Yasuo Ohgaki
Hi Andrey, On Fri, Jan 30, 2015 at 6:43 AM, Andrey Andreev wrote: > > Is somebody actually recommending the latter form? I'm surprised that > it even works ... that should be a syntax error IMO. Do you mean echo "${array[$key]}"; // Works should be errror? This form is common in shell scripti

Re: [PHP-DEV] Use of {} with member.

2015-01-29 Thread Andrey Andreev
Hi, On Thu, Jan 29, 2015 at 11:32 PM, Yasuo Ohgaki 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}; //

[PHP-DEV] Use of {} with member.

2015-01-29 Thread Yasuo Ohgaki
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]}"; // Wor