today i had this problem, i had an array and i wanted to use it in a function, but when i tried to use it it wouldn't work. so if you are also having this issue, hopefully you can learn from my mistakes.

lets say for example i have this php code;



<?php
$array_string = array();
$array_string[0] = "zero";
$array_string[1] = "one";
$array_string[2] = "two";
$array_string[3] = "three";
function ($string){
echo $array_string[3];
?>


that wont work, so what you need to do is call the global array in your function, like this:
<?php
$array_string = array();
$array_string[0] = "zero";
$array_string[1] = "one";
$array_string[2] = "two";
$array_string[3] = "three";
function ($string){
global $array_string;
echo $array_string[3];
?>