Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:53606 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 31514 invoked from network); 28 Jun 2011 10:09:22 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Jun 2011 10:09:22 -0000 Authentication-Results: pb1.pair.com header.from=dave@dmi.me.uk; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=dave@dmi.me.uk; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain dmi.me.uk designates 77.68.52.130 as permitted sender) X-PHP-List-Original-Sender: dave@dmi.me.uk X-Host-Fingerprint: 77.68.52.130 server77-68-52-130.live-servers.net Received: from [77.68.52.130] ([77.68.52.130:42331] helo=scaramanga.siterage.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 4E/70-26207-058A90E4 for ; Tue, 28 Jun 2011 06:09:22 -0400 Received: from localhost (scaramanga.siterage.net [127.0.0.1]) by scanner.scaramanga.siterage.net (SiteRage Mail Server) with ESMTP id 4F4AD121524 for ; Tue, 28 Jun 2011 11:09:18 +0100 (BST) X-Spam-Flag: NO X-Spam-Score: -1.1 X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5 tests=[ALL_TRUSTED=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1] autolearn=ham Received: from scaramanga.siterage.net ([127.0.0.1]) by localhost (scaramanga.siterage.net [127.0.0.1]) (amavisd-new, port 10024) with LMTP id cP0MI+7wZm+1 for ; Tue, 28 Jun 2011 11:09:18 +0100 (BST) Received: from [10.0.0.111] (83-244-232-180.cust-83.exponential-e.net [83.244.232.180]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by scaramanga.siterage.net (SiteRage Mail Server) with ESMTPSA id 05A5612150F for ; Tue, 28 Jun 2011 11:09:18 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=dmi.me.uk; s=scara-dkim; t=1309255758; bh=JAukGEXUA03Rse4DeFFEtmfOFIVZ7oA+sgiownl96V4=; h=Message-ID:Date:From:MIME-Version:To:Subject:References: In-Reply-To:Content-Type:Content-Transfer-Encoding; b=JHMM7o769JSV+xqh7A7eYzL7PT6mG6gEprR5q7TGszyFLgMO9hWA4j4mtmY/yWtTv mt2F18WjlGLw/BB/g1xHCF4KebXYRCWLQitg/g3UDFVaMPdlM+sllNYg/S7YiR7pHp blqU409ckuUvzoQudMSa6EiIeF5LodYHvxb3wneM= Message-ID: <4E09A835.70002@dmi.me.uk> Date: Tue, 28 Jun 2011 11:08:53 +0100 User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110520 Lightning/1.0b3pre Thunderbird/3.1.10 MIME-Version: 1.0 To: "internals@lists.php.net" References: <4E0355AE.4080305@php.net> <4E035B7E.4010703@php.net> In-Reply-To: X-Enigmail-Version: 1.1.2 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Variable scopes for language constructs (foreach, ...) From: dave@dmi.me.uk (Dave Ingram) On 06/23/11 21:48, John Crenshaw wrote: >> I think proposed change is extremely counter intuitive to the design >> of PHP in regard to scoping and would be a very large bc break, PHP is >> doing exactly what it is suppose to do here and I wouldn't want it any >> other way. > Agreed. Although I generally favor the idea of strong scope, it isn't practical to implement in PHP. It isn't sensible because PHP doesn't require explicit variable declaration, and the BC break would be crippling. 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) { } Dave