> First, we define $foo and load it with NULL so that it is available for
> referencing.

It turns out loading $foo is superfluous; I can get away with just:

  $foo = function($foo) use (&$foo) {
       $foo();
  }

> Next, in terms of program logic, we create a closure with a lexical
> ('use') variable of a reference to $foo, which is then assigned to
> $foo. Thus, the reference to $foo in the closure declaration now
> points to the closure itself.

That much is clear; but why $foo is all of the sudden bound within the
closure when I use by reference (&$foo) as opposed to use by value
($foo) is mysterious.

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to