Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:81389 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 20014 invoked from network); 29 Jan 2015 21:43:10 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Jan 2015 21:43:10 -0000 Authentication-Results: pb1.pair.com smtp.mail=narf@devilix.net; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=narf@devilix.net; sender-id=pass Received-SPF: pass (pb1.pair.com: domain devilix.net designates 209.85.218.43 as permitted sender) X-PHP-List-Original-Sender: narf@devilix.net X-Host-Fingerprint: 209.85.218.43 mail-oi0-f43.google.com Received: from [209.85.218.43] ([209.85.218.43:41010] helo=mail-oi0-f43.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 40/80-16616-C69AAC45 for ; Thu, 29 Jan 2015 16:43:09 -0500 Received: by mail-oi0-f43.google.com with SMTP id z81so31468758oif.2 for ; Thu, 29 Jan 2015 13:43:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=devilix.net; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=nqNCiOSVYrUC6yo4MjP1QqIcVRtMnOZ+HmCOVrlYV4E=; b=Ya7VYnxVCZ79chEMgqbg9JsKwZFTRfoDCeivirpCgYA5he7wmEN9E7knFsgaxLNJuC 0RUn5Dzbu5iDJNfJfoFsDRQPZbYife1whbxnNHTHizozAALBb+ekrAExzSeKSescCpyP 2wB7C3FfN1XQeTwb3ZV0DNQNBb2U/I+xN5Jh4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=nqNCiOSVYrUC6yo4MjP1QqIcVRtMnOZ+HmCOVrlYV4E=; b=erHnsHjGJ7QbIHxeKWI+NOuIsUOVA1ps+WF4V2tC5ASMpEq/BqDAdi34Ew3bj1JuCf ikOsCOpYX7JHMWNUGqhcv855xuv80NotdrJ0jaLAlrsa6vSJWn0vD3MJCvBjliZzgMnV cdWnMpjoaoZ66ddnWv8mTsQp9Ob0u7GL3QZjxChnbScojBBDCbY+bVRTzAWIRpmjHTZ3 vM0ea2l93qYVQIQIFyKqm5rOqqTfVMSHaS1JJOBic+ZzM2+7N9B82VOwbxe61hWmqohL iKZ8MGmFkolLxhZHsWOB1pmTFBhX5132lMIEE30em0Sj5LIbxWTqC9H6jemk5oNFuVTt Rsjg== X-Gm-Message-State: ALoCoQm+/YiVvDdQnP2En5w4rs0rxnMbZDOz5/tZdGMLLeUsy8nGGG3BdLKihJEAduTvC3zty2fb MIME-Version: 1.0 X-Received: by 10.202.83.134 with SMTP id h128mr1663886oib.97.1422567786289; Thu, 29 Jan 2015 13:43:06 -0800 (PST) Received: by 10.202.214.205 with HTTP; Thu, 29 Jan 2015 13:43:06 -0800 (PST) In-Reply-To: References: Date: Thu, 29 Jan 2015 23:43:06 +0200 Message-ID: To: Yasuo Ohgaki Cc: "internals@lists.php.net" Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] Use of {} with member. From: narf@devilix.net (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}; // E_NOTICE. Does not work > $obj->{$key}; // Works > > echo "${array[$key]}"; // Works > echo "{$array[$key]}"; // Works > > Of course, script/string parsing aren't the same. Are there technical > reasons > why ${value} is not allowed? If there are, we may encourage > > echo "{$array[$key]}"; // Works > > rather than > > echo "${array[$key]}"; // Works > Is somebody actually recommending the latter form? I'm surprised that it even works ... that should be a syntax error IMO. Cheers, Andrey.