Probably the simplest and cleanest way is to pass the array as an argument to the second function, and have it return the array back to the caller:
Function that processes array in some manner:
function myFunc($myArray)
{
// do stuff with $myArray, then...
return($myArray);
}
Calling function:
function caller()
{
$callerArray = ('foo', 'bar');
$callerArray = myFunc($callerArray);
}
Alternatively, you could pass the array by reference, but the downside of this can be slightly harder to maintain code, as it is less obvious when reading the calling function that the receiving function will be modifying the array that is passed to it:
Function that processes array in some manner:
function myFunc(&$myArray) // note the ampersand character
{
// do stuff with $myArray, then...
return(); // do not need to return array
}
Calling function:
function caller()
{
$callerArray = ('foo', 'bar');
myFunc($callerArray);
// contents of $callerArray may now have been modified by myFunc()
}