Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:81391 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 24310 invoked from network); 29 Jan 2015 22:17:58 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Jan 2015 22:17:58 -0000 Authentication-Results: pb1.pair.com smtp.mail=ajf@ajf.me; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ajf@ajf.me; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ajf.me designates 192.64.116.200 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 192.64.116.200 imap1-2.ox.privateemail.com Received: from [192.64.116.200] ([192.64.116.200:35935] helo=imap1-2.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id CC/31-16616-491BAC45 for ; Thu, 29 Jan 2015 17:17:57 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id 695C5B0008E; Thu, 29 Jan 2015 17:17:53 -0500 (EST) X-Virus-Scanned: Debian amavisd-new at imap1.ox.privateemail.com Received: from mail.privateemail.com ([127.0.0.1]) by localhost (imap1.ox.privateemail.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 5dFoERPbOkgP; Thu, 29 Jan 2015 17:17:53 -0500 (EST) Received: from oa-res-26-240.wireless.abdn.ac.uk (oa-res-26-240.wireless.abdn.ac.uk [137.50.26.240]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.privateemail.com (Postfix) with ESMTPSA id 6C1A1B0007B; Thu, 29 Jan 2015 17:17:51 -0500 (EST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 8.1 \(1993\)) In-Reply-To: Date: Thu, 29 Jan 2015 22:17:49 +0000 Cc: Andrey Andreev , "internals@lists.php.net" Content-Transfer-Encoding: quoted-printable Message-ID: References: To: Yasuo Ohgaki X-Mailer: Apple Mail (2.1993) Subject: Re: [PHP-DEV] Use of {} with member. From: ajf@ajf.me (Andrea Faulds) Hi Yasuo, > On 29 Jan 2015, at 22:14, Yasuo Ohgaki wrote: >=20 > Hi Andrey, >=20 > On Fri, Jan 30, 2015 at 6:43 AM, Andrey Andreev = wrote: >>=20 >> Is somebody actually recommending the latter form? I'm surprised that >> it even works ... that should be a syntax error IMO. >=20 >=20 > Do you mean >=20 > echo "${array[$key]}"; // Works >=20 > should be errror? > This form is common in shell scripting. >=20 > http://tldp.org/LDP/abs/html/parameter-substitution.html >=20 > I'm using it regularly. I guess many users expect following forms to = work. >=20 > $obj->${array[$key]}; // Syntax error > $obj->${key}; // E_NOTICE. Does not work >=20 > 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 =3D= array[$key], $obj->${$key} would make no sense to me. -- Andrea Faulds http://ajf.me/