
08-05-2013, 12:02 PM
|
|
the fake one
|
 |
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
|
|
|
Without spending much time trying to understand your script, it's clear that your recursion is flawed. replaceVal(temp.newstring, temp.oldval, temp.newval); may or may not return anything, but it doesn't matter because you don't return that value, so the original call to the function won't see it. In other words, if the if-statement evaluates to true, which I'm guessing it does in the first call, there will never be a return value.
The echo you are seeing is actually from the deepest function call, and the value is returned correctly, but then you don't do anything with the return value when it is passed back to the same function. My guess is that simply adding return in front of the recursive call will fix it, but I'm not in a position to test it right now. |
|
|
|