Skip to content

Instantly share code, notes, and snippets.

@emjayess
Created October 13, 2011 16:52
Show Gist options
  • Save emjayess/1284774 to your computer and use it in GitHub Desktop.
Save emjayess/1284774 to your computer and use it in GitHub Desktop.
anonymous function using arguments with parent fn's variables
public function parentFn($argVar) {
$decVar = 0.00;
$callback = function ($anonVar) use ($argVar, &$decVar) {
$result += ($decVar * $anonVar) * ($argVar);
};
return round($result, 2);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment