Re: Use of {} with member.
| From: | Yasuo Ohgaki | Date: | Thu, 29 Jan 2015 22:14:41 +0000 |
| Subject: | Re: Use of {} with member. | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-81390@lists.php.net to get a copy of this message | ||
Hi Andrey,
On Fri, Jan 30, 2015 at 6:43 AM, Andrey Andreev <narf@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?
Regards,
--
Yasuo Ohgaki
yohgaki@ohgaki.net