I'm surprised I'm not able to access an array in a function without passing it to the function
$arr = [-4,3,-9,0,4,1];
function print_array()
{
print_r($arr);
}
print_array();
when I run, I'm getting Notice: Undefined variable arr
I though since the array and the function are in the same file, I would be able to access it? Can I not access the array without passing it to the function? I have a bunch of arrays outside, that I need to print in the function. But I don't want to pass each one of them.