G'day!
I have a common problem with recursive functions. Below is a very simple example of that problem. I'd like to build a string (MYSTRING) until the recursive condition becomes false.
But making the variable global, or send it back to the recursive function doesn't help: each recursive called function is a new instance!
How can I avoid this problem?
Thank you.
function makeString($a) {
// Recursive function.
if ($a<5) {
$MYSTRING .="$a WOOHOO ";
makeString($a+1);
}
}