Created
May 31, 2012 11:58
-
-
Save radmen/2842945 to your computer and use it in GitHub Desktop.
Recursive Closure
This file contains hidden or 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
<?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