Re: Global vars

From: Date: Tue, 03 Oct 2000 23:52:41 +0000
Subject: Re: Global vars
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-18494@lists.php.net to get a copy of this message
On Tue, 3 Oct 2000, Ben Wiechman wrote: > settings.php -> contains some variables that I would like to use as global > variables > Several others contain other source code. My problem is that the variables I > define in settings.php are visible in any of the functions in the other src > files. Is there any way to declare global variables? Do I have to use > something with sessions? > You mean the variables you define in settings.php are _NOT_ visible in any of the functions in the other src files, right ? You can access the global variables this way : function Example($arg1, $arg2) { global $some_variable_from_settings_php; // some more code } Regards, Joao -- Joao Prado Maia Web Developer Kefta, Inc. T: (415) 391-6881 ext 8008 F: (415) 391-7079

« previous php.general (#18494) next »