> > At 01:37 AM 4/2/02 +0100, Nick Lindridge wrote: >>Functions inside functions is not an idiom that I >>recommend, and it isn't handled by PHP in the way that it should be. >>i.e. the inner function doens't cease to exist once the outer function >>has completed execution (but correct me if I'm wrong). > > But, unless you have the skills to write the correct SQL for nested > trees (keeping track of the left and right numbers etc) which I don't, > then a recursive function is the only way to do something like build > breadcrumbs. Peter, this has nothing to do with recursion and is not what this case is about. The issue here is that defining a function inside another doesn't work. There are valid design reasons for *doing* this in a language that has scoping concepts, typically if it doesn't make sense for the inner function to be *visible* outside the outer function. e.g. You have a function to call array_walk() to manipulate an array, and the function to be applied by array_walk() has no meaning outside of the function calling array_walk. However the inner function should then go out of scope once the outer function has completed, but this *isn't* what php does. Instead the inner function simply gets added to the function table once and for all. There is no thorough concept or support of scoping with php, and is one of its weaker areas. ------------------------------------------------------------------------ www.php-accelerator.co.uk Home of the free PHP Accelerator To post, send email to phpa@xxxxxxxxxxxxx To unsubscribe, email phpa-request@xxxxxxxxxxxxx with subject unsubscribe