my own superglobals?

From: Date: Wed, 27 Nov 2002 11:06:41 +0000
Subject: my own superglobals?
Groups: php.dev 
Request: Send a blank email to php-dev+get-91810@lists.php.net to get a copy of this message
Hi Gurus Is there any way to make my own variables supeglobal like $_GET, $_POST, ... ? I don't like $GLOBALS and I don't want to write the 'global' keyword each time I use my global variable in functions, I want to have a method to make it superglobal by default. 'Superglobal' means that it is available in all scopes throughout a script. I suggest following syntax: <?php // will declare superglobal variables global $mySuperglobalVariable = "Hello"; // make it superglobal global $_FORM = array_merge($_GET, $_POST); // yet another superglobal function test() { echo($mySuperglobalVariable); print_r($_FORM); // don't need "global $mySuperglobalVariable" // don't need "$GLOBALS['mySuperglobalVariable ']" } ?> I hope it isn't a stupid idea, thaks

« previous php.dev (#91810) next »