This project is read-only.

What is a "Closure"?
A closure is actually a no-name function. So it is usage principles and syntax is as same as any other functions in php.


$closure = function($a){ return $a*2; }

more examples can be found at:

What is "use" identifier in closures?
"use" is a new syntax token for any function, that allows to pass any scope parameter to function and use it as in scope.


$k = 5;
$closureWithUse = function($a)use($k){ return $a*$k; }

Last edited Mar 29, 2011 at 9:50 PM by mowa, version 1


No comments yet.