|  | Posted by Justin Koivisto on 12/27/05 20:22 
rithish@gmail.com wrote:> Is it possible to set a custom server variable so that it may be used
 > in the latter part of a script? Say something like $_SERVER["myvar"] =
 > "myvalue", and then be able to use 'myvar' later.
 
 Yes, you can do that, however once the script ends, the variable is
 gone. If you want to do it across requests you'll need to use sessions
 or some other storage method (database, files, etc.)
 
 If you want to set a server "variable" it acts more like a constant. For
 instance, if you use Apache and have done something like:
 
 SetEnv apache_var1=34
 
 Then in (all) your php scripts, $_SERVER['apache_var1'] == 34
 
 You cannot do something like $_SERVER['apache_var1'] = 63 and have the
 next request produce that value...
 
 --
 Justin Koivisto, ZCE - justin@koivi.com
 http://koivi.com
  Navigation: [Reply to this message] |