|
Function to load vars in PHP?
I made an app in PHP, where a large string of vars is loaded (and can be reloaded in certain instances to validate them).
Basically, I want to have a function where vars are loaded, but I don't want them to be global, because they need to stay in the validation functions.
So, I know this won't work, but this is what I want to do:
INSTEAD of this:
Code:
$var1 = $systemvars['var1']
$var2 = $systemvars['var2']
ect.....I WANT to do this:
Code:
function load_vars()
{
$var1 = $systemvars['var1']
$var2 = $systemvars['var2']
ect.....
}
function valid()
{
load_vars);
if (isset($var1 ))
echo "hi!";
}Thanks.
|