Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:39080 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 69852 invoked from network); 18 Jul 2008 10:06:16 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Jul 2008 10:06:16 -0000 Authentication-Results: pb1.pair.com header.from=rquadling@googlemail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=rquadling@googlemail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain googlemail.com designates 72.14.220.154 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: rquadling@googlemail.com X-Host-Fingerprint: 72.14.220.154 fg-out-1718.google.com Received: from [72.14.220.154] ([72.14.220.154:36905] helo=fg-out-1718.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 82/1B-31728-61B60884 for ; Fri, 18 Jul 2008 06:06:15 -0400 Received: by fg-out-1718.google.com with SMTP id 16so168804fgg.23 for ; Fri, 18 Jul 2008 03:06:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:reply-to :to:subject:cc:in-reply-to:mime-version:content-type:references; bh=C8YQH5AkDeMsATyx/2V6QT94Ul1tqBBwMFd385uPgck=; b=f68IzbE9jO56SmDiS2Vi59Pm9dG41GMJnYtWfKfVZGwIMJj4pIX2i686RYT0pFVjWE H1BCxzmsiMSkbYl3BFpkKDqqWy2CAI/mDsjg2GvWx0/rb8o7tAD1fPidn3+l0hAehEJS onS6PzICJPJdEqeJwPKZveGkKy8kYKuTS39eE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=message-id:date:from:reply-to:to:subject:cc:in-reply-to :mime-version:content-type:references; b=CycAu88KvwFkB2uQfZc2rmIuUzSASxzQSqxL/oa04zer+35l6t4ICMHttJuZdG0rTI z6ft9mteXfDwYddCeP09noIDorbLipxEe/QxdiH6WLnIJCfMgWUVxhogGizvwld/wRdf SZc2+8M0jylJE+cJ6kvXB9gKusP77XV4VFksY= Received: by 10.86.71.1 with SMTP id t1mr58472fga.36.1216375570902; Fri, 18 Jul 2008 03:06:10 -0700 (PDT) Received: by 10.86.97.3 with HTTP; Fri, 18 Jul 2008 03:06:10 -0700 (PDT) Message-ID: <10845a340807180306l6b2f78ek12d17a6729682d43@mail.gmail.com> Date: Fri, 18 Jul 2008 11:06:10 +0100 Reply-To: RQuadling@GoogleMail.com To: "Moriyoshi Koizumi" Cc: "Larry Garfield" , internals@lists.php.net In-Reply-To: <50CB07D0-D4A6-45AF-9E54-A2D1C4F2E7BC@at.wakwak.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_1810_7627281.1216375570608" References: <54FF091B-A4BE-4C3E-9783-D2DE93D6AF31@at.wakwak.com> <200807180110.38919.larry@garfieldtech.com> <50CB07D0-D4A6-45AF-9E54-A2D1C4F2E7BC@at.wakwak.com> Subject: Re: [PHP-DEV] [PATCH] Allow use($var..) statement ubiquitously From: rquadling@googlemail.com ("Richard Quadling") ------=_Part_1810_7627281.1216375570608 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline 2008/7/18 Moriyoshi Koizumi : > That's one of the motivations for the patch. I never liked the new syntax, > but if it was given a go, it should also be made consistent with the another > part of the syntax. Oh, I just got one important thing in mind to mention; > > test1.php: > function a() { > $a = "bar"; > include("test2.php"); > } > > $a = "foo"; > a(); > b(); > ?> > > test2.php: > function b() use ($a) { > echo $a, "\n"; > } > b(); > ?> > > running test1.php ends up with two lines of "bar", surprisingly. This is > somewhat confusing, but surely one of the things that could not ever be > done. This might be a great help when you use a PHP-script file as a mark-up > template. > > Moriyoshi > It was my understanding that include-d functions were added to the global scope (or I suppose the active namespace). So, in that context, function b() use($a) {} should be getting the $a from the global scope where $a == "foo". I would say that getting 2 "bar"s is wrong. Richard. -- ----- Richard Quadling Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731 "Standing on the shoulders of some very clever giants!" ------=_Part_1810_7627281.1216375570608--