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.