session_register: incorporate notes

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@65642 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
jim winstead 2001-12-18 22:43:31 +00:00
parent a7f3d554ea
commit a5780c82e3

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.68 $ -->
<!-- $Revision: 1.69 $ -->
<reference id="ref.session">
<title>Session handling functions</title>
<titleabbrev>Sessions</titleabbrev>
@ -570,16 +570,45 @@ echo "The previous session name was $previous_name<p>";
</funcprototype>
</funcsynopsis>
<para>
<function>session_register</function> variable number of
arguments, any of which can be either a string holding the
variable name or an array consisting of such variable names or
other arrays. For each encountered variable name,
<function>session_register</function> registers the global
variable named by it with the current session.
<function>session_register</function> accepts a variable number of
arguments, any of which can be either a string holding the name of a
variable or an array consisting of variable names or other arrays. For
each name, <function>session_register</function> registers the global
variable with that name in the current session.
</para>
<caution>
<para>
This registers a <emphasis>global</emphasis> variable. If you want to
register a session variable inside a function, you need to make sure to
make it global using <function>global</function> or use the session
arrays as noted below.
</para>
</caution>
<para>
This function returns &true; when all of the variables are successfully
registered with the session.
</para>
<para>
This function returns &true; when the variable is successfully
registered with the session.
If <function>session_start</function> was not called before this function
is called, an implicit call to <function>session_start</function> with no
parameters will be made.
</para>
<para>
You can also create a session variable by simply setting the appropriate
member of the $HTTP_SESSION_VARS or $_SESSION (PHP >= 4.1.0) array.
<informalexample>
<programlisting role="php">
<![CDATA[
$barney = "A big purple dinosaur.";
session_register("barney");
$HTTP_SESSION_VARS["zim"] = "An invader from another planet.";
# the auto-global $_SESSION array was introduced in PHP 4.1.0
$_SESSION["spongebob"] = "He's got square pants.";
]]>
</programlisting>
</informalexample>
</para>
<note>
<para>
@ -594,6 +623,10 @@ echo "The previous session name was $previous_name<p>";
<link linkend="resource">resource types</link> appendix.
</para>
</note>
<para>
See also <function>session_is_registered</function> and
<function>session_unregister</function>.
</para>
</refsect1>
</refentry>