Re: Global variables? (unset/set or what?)

From: Date: Sat, 19 May 2001 22:27:15 +0000
Subject: Re: Global variables? (unset/set or what?)
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-53567@lists.php.net to get a copy of this message
So i should start the header (or wherever in the header) with : $GLOBALS["userPassword"] = "whatever"; function cp() { global $userPassword; // $userPassword is 'whatever' // } Did I get it or am I just too tired? - Richard "Michael Stearne" <mstearne@entermix.com> wrote in message news:3B06F2A6.A8A6753A@entermix.com... > Try the define function. That will define a constant that you will always have > access to (within functions, through various included files,etc.) Or you can > write values to the $GLOBALS array of global variables. > > $GLOBALS["userPassword"]="u8943fd"; > > Will define a variable that is accessible as $userPassword. outside of > functions and within functions available after the global $userPassword; > command is within the function. > > HTH, > Michael > > > Richard wrote: > > > Greetings. > > > > I have about two include files which are included in every php page that > > I have, and I wish to store global variables, such as passwords, usernames > > and other details information. > > After going through the PHP manual, all I could find was UNSET/SET > > global variables, but I don't know if that is the one to use or not... they > > looked like if they were to be doing something else. > > > > Any help or ideas? > > > > - Richard > > > > -- > > 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 > > > -- > 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 >

« previous php.general (#53567) next »