Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 05-09-2009
Member
 
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.
Reply With Quote
  #2  
Old 05-09-2009
Member
 
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.
Reply With Quote
  #3  
Old 05-09-2009
Member
 
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.
Reply With Quote
  #4  
Old 05-09-2009
Member
 
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.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


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


All times are GMT +5.5. The time now is 07:43 PM.