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