There's a couple of ways you could do this...
- search zend.com and other PHP sites for something similar :)
- pick up Joe Celko's "SQL for Smarties" which talks about building trees
and graphs in SQL (which is what this is)... this can get kind of
complicated though.
or...
- modify your tabl
Recursive functions are generally a bad idea especially in php.
By using a recursive function it is possible you may "smash the stack", which
will crash an apache child (segfaults) and on a multi-threaded server take
down the whole webserver.
Even with a default memory limit of 8 megs an attacke
recursion is something that can be fun and practical at times, other times
its a bad coder trying to do something they think is clever. use it wisly.
this example is purposely coded bad to show you how recursion can mess up
with bad error checking. this example will work. change to power(30) a
3 matches
Mail list logo