Re: user-defined superglobals?
| From: | Ray Hunter | Date: | Sat, 23 Aug 2003 18:01:47 +0000 |
| Subject: | Re: user-defined superglobals? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-160516@lists.php.net to get a copy of this message | ||
you can define your own superglobals by defining the vars first then
accessing them thru the $GLOBALS var.
example:
<?php
// file1.php
$var1 = "test1\n";
$var2 = "test2\n";
?>
<?php
// file2.php
include( 'file1.php' );
function test() {
echo $GLOBALS['var1'];
echo $GLOBALS['var2'];
echo "Test\n"
}
test();
?>
That should get you started with globals.
--
BigDog
On Sat, 2003-08-23 at 11:45, Matthias Nothhaft wrote:
> Hi List,
>
> is there a way (mybe in php5?) to define/declare a global var as a
> superglobal, so that I can use this var like the known superglobals
> ($_GET, $_SESSION, etc.) ???
>
> If not, is there a list for "feature requests"?
>
>
> Regards,
> Matthias
>