Hi Yasuo, > On 29 Jan 2015, at 22:14, Yasuo Ohgaki <yohg...@ohgaki.net> wrote: > > Hi Andrey, > > On Fri, Jan 30, 2015 at 6:43 AM, Andrey Andreev <n...@devilix.net> 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 scripting. > > http://tldp.org/LDP/abs/html/parameter-substitution.html > > I'm using it regularly. I guess many users expect following forms to work. > > $obj->${array[$key]}; // Syntax error > $obj->${key}; // E_NOTICE. Does not work > > What others expect?
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. -- Andrea Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php