[thelist] PHP sessions syntax

Nan Harbison nan at nanharbison.com
Sun Jul 22 07:24:46 CDT 2007

Hi All,
I need to use sessions in a website I am working on. I am finding
conflicting information on this when I google for it. One major problem is
that many of the articles I have found were written in 2003 or earlier, and
the books I have lying around my office are older too. (I am using PHP
Version 4.3.11)
 My question is how to correctly set session variables.
I have always used:
  session_register ('user_id');
  session_register ('first_name');
but now I have read you can just set session vars to something, like:
$_SESSION["first_name"] = "Nan";
Is the way I have always used been deprecated or can I still safely use it?
Another question, do I need to use:
["real_name"], ['real_name'] or [real_name] - double or single quotes, or no
quotes. IIRC, $HTTP_SESSION_VARS did not use quotes at all. I have seen
single and double quotes used, but don't know if there is a difference?

More information about the thelist mailing list