Difference between 'session_register' and a $_SESSION variable?

Hi
Can someone explain when to use session_register() versus using a session variable? What I mean is: Say a user successfully logs in, do I have to use:

session_register('username');
then use
if(session_is_registered('username'))
elsewhere to validate

or can I just create a regular session variable and set it to some value and use that to check whether a user logged in correctly?
$_SESSION['username'] = LOGGED_IN;
then use
if($_SESSION['username'] == LOGGED_IN)
elsewhere to validate

Thanks
tr5
tr5Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

hernst42Commented:
session_register is old php-style for php < 4.4.x and may never used in conjunction with $_SESSION. See http://www.php.net/manual/en/function.session-register.php The new way is tu use session_start() and the access session variables via $_SESSION.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
tr5Author Commented:
I ahve php 5. Are you saying I should remove from my code, this:
session_register('username');
.....
if(session_is_registered('username'))

and do something like this instead?
$_SESSION['username'] = LOGGED_IN;
.....
if(isset($_SESSION['username']) && $_SESSION['username'] == LOGGED_IN)
0
hernst42Commented:
Yes, that how new PHP-code should look like.
0
tr5Author Commented:
Thank you
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.