Can you make a PHP function recursive without repeating it's name?
- by alex
It's always bugged me a recursive function needs to name itself, when a instantiated class can use $this and a static method can use self etc.
Is there a similar way to do this in a recursive function without naming it again (just to cut down on maintenance)?
Obviously I could use call_user_func or the __FUNCTION__ constant but I would prefer something less ugly.
Update
Thanks for your answers. I might stick to including the function name for simple functions, and make take the other approaches for anything more complicated.