Michael Collins wrote:
I am relatively new at PHP and wondering why there is no mechanism to create user-defined superglobals? For example in ASP.Net I can setup a global.asa to define database connections or any named value I want to be available anywhere in an application. It would be great to have something like that in PHP.
You can do the same thing with a PHP file and have it auto_prepended to your scripts or just include() it yourself.
You can't make your own superglobals, but you can assign keys to the existing ones, if you really want.
$_SERVER['MY_DATABASE_USER'] = 'user'; $_SERVER['MY_DATABASE_PASS'] = 'pass';
mysql_connect('localhost',$_SERVER['MY_DATABASE_USER'],$_SERVER['MY_DATABASE_PASS']);
etc...
-- ---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php