recursive function problem
Moderator: General Moderators
recursive function problem
im running a recursive function but its got a glitch in it that when i use return in the function it doesnt call it again. rest assured that the return and the re-call are in seperate if-else clauses so i dont think that the return is terminating the script before the function is re-called.any ideas?
Re: recursive function problem
Can you show us the code?
-
montana111
- Forum Newbie
- Posts: 6
- Joined: Thu May 28, 2009 7:51 pm
Re: recursive function problem
yeah if you could show us the code that would be helpful. in general tho i find that when im having trouble with something like this it is because i want to make a recursive function but i start it out iteratively and then its just a bad algorithm. idk tho, im new to php so post the code and maybe something will happen
Re: recursive function problem
Of course it won't call it again if you're returning something. When you return something that should be the end of the recursion. Don't return if you're not doing recursing. 
I think what you want to do is pass what you're currently returning to the function again as a parameter. But like the others have said, it is hard without seeing any code.
I think what you want to do is pass what you're currently returning to the function again as a parameter. But like the others have said, it is hard without seeing any code.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.