2008/7/18 Moriyoshi Koizumi <[EMAIL PROTECTED]>:

> 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:
> <?php
> function a() {
>    $a = "bar";
>    include("test2.php");
> }
>
> $a = "foo";
> a();
> b();
> ?>
>
> test2.php:
> <?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!"

Reply via email to