使用参数“global”时,PHP函数无法识别所需文件中的数组

How can it be that the below works:

require('../PHP/array.txt');
function printarray($includedarray){
print_r($includedarray);
}
printarray($includedarray);

but the following doesn't:

require('../PHP/array.txt');
function printarray(){
global $includedarray;
print_r($includedarray);
}
printarray();

when indeed there is an array called "$includedarray" in the required file. I'm not getting an error message or anything on the second example. How is this possible... I don't even know where to begin looking for an answer on this one.

Note that the php file which requires array.txt is previously included from another PHP file. But surely this cannot be an issue as the first example does work.