Re: Umm.. accessing variables in a required file from another file

From: Date: Thu, 31 Aug 2000 19:04:11 +0000
Subject: Re: Umm.. accessing variables in a required file from another file
Groups: php.general 
Request: Send a blank email to php-general+get-14662@lists.php.net to get a copy of this message
If you're trying to access the globals from within the scope of a function or class, you have to declare the globals: function foo() { global $USERNAME, $PASSWORD; } Alternatively, access them like this: $GLOBALS['USERNAME'] and $GLOBALS['PASSWORD'] in any scope. -*- Dave -*- On Thu, 31 Aug 2000 14:40:19 -0400, Chad Day said: > That's a really bad topic, but I'm not sure how to explain what I want so > shortly. > > I have a file that stores global variables (globals.php), such as: > > $MESSAGE = "Your login name is $USERNAME, and your password is $PASSWORD."; > > $USERNAME and $PASSWORD are generated in another file, called sendpw.php. > If I try to use the $MESSAGE variable in sendpw.php, it works, but $USERNAME > and $PASSWORD are not set. How do I go about accessing those variables from > the global file? > > Chad Day > Beach Associates > > When I speak german... I think german in my head... but like...Do skript > kiddies see a w40l3 8uncha 1's and 0's and 3's and 4's and 7's in > their > h34d'5 w43n t43y R +a1k1n6 ? -- SirStanley > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > > -- Dave Seidel CulturePort, Inc. dave@superluminal.com

« previous php.general (#14662) next »