Re: url?variable and classes
| From: | Matt McClanahan | Date: | Sun, 06 Aug 2000 21:51:31 +0000 |
| Subject: | Re: url?variable and classes | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-10380@lists.php.net to get a copy of this message | ||
On Sun, 6 Aug 2000 venome@gmx.net wrote:
> is there a way to make variables defined in the url
>
> (e.g. http://blah.com?command=post)
>
> and, equally, values that come from a form available to a function of a
> class? that is, can't i access those variables from inside a function?
Yes, this is what 'global' is for.
function myfunction()
{
global $PHP_SELF; // This is a global variable.
global $command; // Using your URL above.
}
Of course, you could also simply pass the variables to the function.
function myfunction($var1,$var2)
{
echo "Var1 is: $var1 and Var2 is: $var2\n";
}
myfunction($PHP_SELF,$command);
Matt