Skip to content

Instantly share code, notes, and snippets.

@metasansana
Created September 1, 2013 15:01
Show Gist options
  • Save metasansana/6404961 to your computer and use it in GitHub Desktop.
Save metasansana/6404961 to your computer and use it in GitHub Desktop.
PHP closure.
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