cvs: phpdoc /en/functions session.xml

From: Date: Tue, 18 Dec 2001 22:43:32 +0000
Subject: cvs: phpdoc /en/functions session.xml
Groups: php.doc 
Request: Send a blank email to phpdoc+get-969340068@lists.php.net to get a copy of this message
jimw Tue Dec 18 17:43:32 2001 EDT Modified files: /phpdoc/en/functions session.xml Log: session_register: incorporate notes Index: phpdoc/en/functions/session.xml diff -u phpdoc/en/functions/session.xml:1.68 phpdoc/en/functions/session.xml:1.69 --- phpdoc/en/functions/session.xml:1.68 Tue Dec 18 17:22:54 2001 +++ phpdoc/en/functions/session.xml Tue Dec 18 17:43:31 2001 @@ -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,17 +570,46 @@ </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 the variable is successfully + This function returns &true; when all of the variables are successfully registered with the session. </para> + <para> + 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> It is not currently possible to register resource variables in a @@ -594,6 +623,10 @@ <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>

« previous php.doc (#969340068) next »