Re: Use of {} with member.

From: Date: Thu, 29 Jan 2015 22:49:24 +0000
Subject: Re: Use of {} with member.
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-81392@lists.php.net to get a copy of this message
Hi Andrea, On Fri, Jan 30, 2015 at 7:17 AM, Andrea Faulds <ajf@ajf.me> 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 variable variable. PHP works as follows now. http://3v4l.org/dpbES Andrey, the reason why you are surprised is probably because of this // echo "${obj->var}"; // Syntax error Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net

« previous php.internals (#81392) next »