problem with returning values
Posted: Wed Jun 08, 2005 10:02 pm
I have a recursive function to which i pass a file that contains characters like %%%% (there are 3 of them) which I replace with dynamic content.
it roughly looks like this:
When I print the array at else, the recursive array is just as I expected. However, nothing is returned.
When I put a return $array at marker 1, the file is returned, however it is not the completed array.
Why does this happen?
How do I return a value at else?
it roughly looks like this:
Code: Select all
function recursive($array)
{
if %%%% exists
{
replace it
recursive($array)
}
else
{
print_r $array
return $array
}
< marker 1>
}When I put a return $array at marker 1, the file is returned, however it is not the completed array.
Why does this happen?
How do I return a value at else?