Re: global variables
| From: | Austin Marshall | Date: | Sun, 05 May 2002 16:52:26 +0000 |
| Subject: | Re: global variables | ||
| References: | 1 | Groups: | php.general php.general |
| Request: | Send a blank email to php-general+get-96159@lists.php.net to get a copy of this message | ||
Jule wrote:
Hey, i'm just wondering if there is another way to write global variables to a global.php, now i just the whole fopen etc script, where i open a file and write the sctring $number_right = [whatever number it is] to the file, but is there a different way to write it to the file with one simple command? i could use cookies, but i prefer a simpler way. thanks JuleAt want point did you stop and think that it would be *easier* to write information to a file? You could use cookies and should use cookies if your looking for a simpler way, sessions as well. If you don't mind information not being around the next time the user returns (after closing his/her browser) you could write to the always global always available $_SESSION array. For example $_SESSION['foo']="bar"; and $_SESSION['bar']="foo"; It's not writing to a file, but is one simple command and the information you store will follow them anywhere within your site. If you want save the information you could just as easily use $_COOKIES. But would require that you use the setcookie command.