Quote:
Originally Posted by Ocean
Does that need to work in both directions? In other words, do I have to do that for variables created inside the function if I need to reference them outside of the function?
Also, that process is not insignificant in size for a function that references/uses many variables. Is there any way I can easily state that I want ALL variables within the function to be Global?
|
If you want values calculated in the function to be available after, you'd probably want to do this by returning them.
then you'll have
PHP Code:
function foo()
{
global $DB_site, $bbuserinfo;
$fooreturn = $bbuserinfo['usergroupid'];
return $fooreturn;
}
You'd then use it like this:
PHP Code:
if ($_REQUEST['do'] == "foo-it")
{
$foooutput = foo();
echo $foooutput;
}
If you want to return multiple values, return an array.