Hey.
To add to an array from withing a recursive function, you need to either import a global variable into the function, or pass it as a reference parameter.
$myArray = array();
function setValue($value) {
if($value < 100) {
global $myArray;
$myArray[] = $value;
setValue($value+1);
}
}
function setValue($value, &$myArray) {
if($value < 100) {
$myArray[] = $value;
setValue($value+1);
}
}
$myArray = array();
setValue(1, $myArray);
I would recommend the second option, because it gives you more control over how the variables are handled.
If this is not what you are talking about, please explain this better. Code examples are also very helpful.