I have a function called
chewbacca() {
include('external.php');
echo $lang[1];
...
}
The file external.php contains all the $lang array. However, since I have to execute the function thousands of times, I would like to include only once the file. If I include_once(‘external.php’); before the function, how can I use the $lang array variables in my function without having to write “global” before each use?
Unless I’m misunderstanding what you’re after, you don’t need to write
globalbefore each use, you just have to use it at the start of the function.