Created
September 1, 2013 15:01
-
-
Save metasansana/6404961 to your computer and use it in GitHub Desktop.
PHP closure.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function outer (int $outerArg) { //this could also be a custom type | |
return function (int $innerArg) { // closure function | |
return $outerArg+$innerArg; | |
} | |
} | |
$result = outer(1)(2); // result will be equal to 3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment