Hi Fabio. hope this helps.
Lets say you pass a variable called username to a script via a form. Now you want to access this variable inside a function called test. you have two options that I know of.
// option 1
// declare that you want to use the
// global variable locally
function test()
{
global $username;
echo ($username);
}
// option 2
// explicitly use the global variable
// by accessing the globals variable
function test()
{
echo ($GLOBALS["username"]);
}
see these two pages:
http://php.net/manual/en/language.variables.scope.php
http://php.net/manual/en/language.variables.predefined.php