It is possible to forward variables to functions, then edit them, then return them, but thats a lot of code thats not really neccesary.
If you have a variable thats used in a LOT of functions and which a lot of functions have to modify, using a global is the most simple way of doing it. Like I said, don't use many, but there are a few occasions when using a global is the way to go.
Example of the other option:
PHP Code:
$var['setting']['title'] = "Hello world!";
$var = changeTitle($var);
/* $var[setting][title] now has the value "Boo!". */
function changeTitle($var) {
$var['setting']['title'] = "Boo!";
return $var;
}
This works, however, once you get more complex functions you will want to give them several parameters, defined in different locations. Eventually you'll end up with something like changeTitle($page, $username, $userlevel, $location, $language, $errors, $var). Thats obviously not very readable, especially not when you have to add all those vars to a lot of different functions. In those cases, its IMHO better to use one or two globals.
Note that the previous is similar to:
PHP Code:
$var['setting']['title'] = "Hello world!";
changeTitle();
/* $var[setting][title] now has the value "Boo!". */
function changeTitle() {
global $var;
$var['setting']['title'] = "Boo!";
}