Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:53608 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 34908 invoked from network); 28 Jun 2011 10:22:57 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Jun 2011 10:22:57 -0000 Authentication-Results: pb1.pair.com header.from=adam@adamharvey.name; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=adam@adamharvey.name; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain adamharvey.name designates 209.85.214.170 as permitted sender) X-PHP-List-Original-Sender: adam@adamharvey.name X-Host-Fingerprint: 209.85.214.170 mail-iw0-f170.google.com Received: from [209.85.214.170] ([209.85.214.170:53899] helo=mail-iw0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E4/21-26207-08BA90E4 for ; Tue, 28 Jun 2011 06:22:56 -0400 Received: by iwn36 with SMTP id 36so15902iwn.29 for ; Tue, 28 Jun 2011 03:22:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adamharvey.name; s=google; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=KDp1rwRTc8AXQey15VBEPNW8VI4hR8bJvblukKHKAng=; b=XaK2FfXyqq3oBBXtHX1rhXxdCU/VGhAk7jZiTfafD15ZeGGnQWZJi8qMAKNAQ4j2zM quHq0w80ZZfh0G2QYSuxQ0uTuncY+trfcvlelS3HHKegs+DFADkwrPX0ZJdw4NGc3wIF BoWk+WMlYycxYXrXAADouihxsduKM6FbKH2KQ= Received: by 10.231.91.208 with SMTP id o16mr6989883ibm.49.1309256573969; Tue, 28 Jun 2011 03:22:53 -0700 (PDT) MIME-Version: 1.0 Sender: adam@adamharvey.name Received: by 10.231.158.69 with HTTP; Tue, 28 Jun 2011 03:22:32 -0700 (PDT) In-Reply-To: <4E09A835.70002@dmi.me.uk> References: <4E0355AE.4080305@php.net> <4E035B7E.4010703@php.net> <4E09A835.70002@dmi.me.uk> Date: Tue, 28 Jun 2011 18:22:32 +0800 X-Google-Sender-Auth: 3CNLB6ej2oZUeScVQsAcVLYjZi8 Message-ID: To: Dave Ingram Cc: "internals@lists.php.net" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Variable scopes for language constructs (foreach, ...) From: aharvey@php.net (Adam Harvey) On 28 June 2011 18:08, Dave Ingram wrote: > So what about modifying the loop syntax slightly, to explicitly scope a > variable in a foreach? Or would this be problematic/counter-intuitive too= ? > > foreach ($abc as var $def) { > } > > and > > foreach ($abc as var &$def) { > } PHP's scoping behaviour =E2=80=94 particularly around foreach loops and references =E2=80=94 confuses the hell out of people already. I don't think adding another optional mode that's triggered by a keyword is going to make that any less confusing, frankly. Adam