Skip to content

Instantly share code, notes, and snippets.

@radmen
Created May 31, 2012 11:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save radmen/2842945 to your computer and use it in GitHub Desktop.
Save radmen/2842945 to your computer and use it in GitHub Desktop.
Recursive Closure
<?php
// this is needed
$foo = null;
$foo = function($no = 1) use (& $foo) {
echo "Foo: {$no}\n";
if($no < 10) {
$foo($no + 1);
}
};
$foo();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment