Global vars

From: Date: Tue, 03 Oct 2000 23:34:22 +0000
Subject: Global vars
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-18489@lists.php.net to get a copy of this message
Does PHP not support global variables the way that perl and other languages like C do? I have a main script file and I include several other files from this as needed with the "require" command. 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? My require statements <?php // error_reporting(0); // Don't display errors require( "/home/webs/xwsonline.com/www-docs/PHP_pub_test/settings.php" ); require( "/home/webs/xwsonline.com/www-docs/PHP_pub_test/pages.php" ); require( "/home/webs/xwsonline.com/www-docs/PHP_pub_test/editnodes.php" ); require( "/home/webs/xwsonline.com/www-docs/PHP_pub_test/setup.php" ); ?> Snippet of code from settings.php $product = "PHP Page Publisher"; $ver = "1.0"; $client_add = 1; $client_edit = 1; $client_remove = 1; (And yes settings.php has <?php ... ?> tags) These variables are visible in the main script file. Thanks in advance for any clarification... Ben

« previous php.general (#18489) next »