ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> phpdoc
phpdoc
[PHP-DOC] cvs: phpdoc /en/functions session.xml
by jim winstead other posts by this author
Dec 18 2001 10:43PM messages near this date
[PHP-DOC] cvs: phpdoc /en/functions filesystem.xml | [PHP-DOC] cvs: phpdoc /ja/chapters intro.xml
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> 
 

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved