<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Session variables</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="reserved.variables.request.html">$_REQUEST</a></div> <div class="next" style="text-align: right; float: right;"><a href="reserved.variables.environment.html">$_ENV</a></div> <div class="up"><a href="reserved.variables.html">Predefined Variables</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="reserved.variables.session" class="refentry"> <div class="refnamediv"> <h1 class="refname">$_SESSION</h1> <h1 class="refname">$HTTP_SESSION_VARS [deprecated]</h1> <p class="verinfo">(PHP 4 >= 4.1.0, PHP 5)</p><p class="refpurpose"><span class="refname">$_SESSION</span> -- <span class="refname">$HTTP_SESSION_VARS [deprecated]</span> — <span class="dc-title">Session variables</span></p> </div> <div class="refsect1 description" id="refsect1-reserved.variables.session-description"> <h3 class="title">Description</h3> <p class="para"> An associative array containing session variables available to the current script. See the <a href="ref.session.html" class="link">Session functions</a> documentation for more information on how this is used. </p> <p class="simpara"> <var class="varname"><var class="varname">$HTTP_SESSION_VARS</var></var> contains the same initial information, but is not a <a href="language.variables.superglobals.html" class="link">superglobal</a>. (Note that <var class="varname"><var class="varname">$HTTP_SESSION_VARS</var></var> and <var class="varname"><var class="varname">$_SESSION</var></var> are different variables and that PHP handles them as such) </p> </div> <div class="refsect1 changelog" id="refsect1-reserved.variables.session-changelog"> <h3 class="title">Changelog</h3> <p class="para"> <table class="doctable informaltable"> <thead> <tr> <th>Version</th> <th>Description</th> </tr> </thead> <tbody class="tbody"> <tr> <td>4.1.0</td> <td> Introduced <var class="varname"><var class="varname">$_SESSION</var></var> that deprecated <var class="varname"><var class="varname">$HTTP_SESSION_VARS</var></var>. </td> </tr> </tbody> </table> </p> </div> <div class="refsect1 notes" id="refsect1-reserved.variables.session-notes"> <h3 class="title">Notes</h3> <blockquote class="note"><p><strong class="note">Note</strong>: <p class="para">This is a 'superglobal', or automatic global, variable. This simply means that it is available in all scopes throughout a script. There is no need to do <strong class="command">global $variable;</strong> to access it within functions or methods. </p></p></blockquote> </div> <div class="refsect1 seealso" id="refsect1-reserved.variables.session-seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"> <span class="function"><a href="function.session-start.html" class="function" rel="rdfs-seeAlso">session_start()</a> - Start new or resume existing session</span></li> </ul> </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="reserved.variables.request.html">$_REQUEST</a></div> <div class="next" style="text-align: right; float: right;"><a href="reserved.variables.environment.html">$_ENV</a></div> <div class="up"><a href="reserved.variables.html">Predefined Variables</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>