Results 1 to 4 of 4

Thread: What is the difference between session_register and $_session?

  1. #1
    Join Date
    May 2008
    Posts
    248

    What is the difference between session_register and $_session?

    Please suggest me the difference between session_register and $_session? Does this session registration is concerned with the actual session where I would be concerned about each session time.

  2. #2
    Join Date
    Oct 2008
    Posts
    167

    Re: What is the difference between session_register and $_session?

    Following are differences between session_register and $_SESSION

    The very first main and simple difference is that session_register function returns boolean value and $_SESSION returns string value. The second will be session_register function doesn't work if register_global is disabled. But whereas $_SESSION works in both case whether register_global is disabled or enabled. So using $_SESSION for session variable manipulation is more appropriate.

  3. #3
    Join Date
    Jan 2009
    Posts
    140

    Re: What is the difference between session_register and $_session?

    $_SESSION (uppercase !)is a superglobal. You treat it like an associative array, and you can store your session variables in it. session_register() is used for register one or more global variables with the current session. session_register is old php-style for php < 4.4.x and may never used in conjunction with $_SESSION. While $_SESSION[] array is used for storing one or more variables with in the current session array. session_register() depends upon register_global is enable or disable, If it disable it will not work.

  4. #4
    Join Date
    Feb 2009
    Posts
    105

    Re: What is the difference between session_register and $_session?

    I read in some blog that using $_SESSION[var]=value is better than using session_register. It is because session_register() only works if register_globals is set ON in your php.ini file. Use $_SESSION , and don't forget to start the session since the strict beginning of the script (before session_start(), only include the classes definition if an instance is stored as a session variable.

Similar Threads

  1. How to Register a Variable with $ _SESSION?
    By The Recruiter in forum Software Development
    Replies: 4
    Last Post: 28-02-2010, 01:00 AM
  2. Difference between jsp and asp.net
    By Crespin in forum Software Development
    Replies: 3
    Last Post: 24-11-2009, 06:57 AM
  3. Difference Between Vba and Vba-m
    By Chaya in forum Operating Systems
    Replies: 3
    Last Post: 07-08-2009, 11:46 AM
  4. What is the difference between JSP and PHP?
    By Volodymyra in forum Software Development
    Replies: 3
    Last Post: 20-04-2009, 10:23 PM
  5. What is the Difference between Blu-ray and HD-DVD?
    By Maryna in forum Hardware Peripherals
    Replies: 3
    Last Post: 06-01-2009, 01:43 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,533,659.18293 seconds with 16 queries