Recursive closures in PHP
Being quite a JavaScript aficionado, I am used to and quite like functional programming, I finally got the opportunity to use a closure in PHP, a recursive one at that.
Is there a benefit to using closures?
To be honest from the PHP code I write, which is usually in codeigniter and thus always inside the scope of an object, using recursive closures doesn't really bring a huge benefit. In actual fact I find using them might lead to a bit of a disadvantage when it comes to writing DRY software.
What does it look like?
For a closure to be able to call itself through recursion, you have to pass the closure to itself by reference as your variables would not normally exist in the function scope.
Thoughts
I don't think I'm suddenly going to go haywire for anonymous functions in PHP, I doubt that it helps with writing maintainable easy to understand code, but I think it's pretty cool at the same time and hopefully I'll find a valid use case for them someday.