Global scope allows you to use a variable in a function that was defined outside the function. eg
$a=1;
function $test(){
echo $a;
}
//outputs 1
but why is it that if I define a variable with an array I cannot use it the same way?
$test = array(
0=>'zero',
1=>'one',
2=>'two',
3=>'three',
);
function doesntWork($something){
echo "My favorite number is " . $test[$something];
}
//outputs My favorite number is 0
How do i pass the array into the function without having to recopy the array into the function itself.
any explanation would be appreciated thanks