Changing $GLOBALS to $_SESSION

I’ve had problems with a login page I’ve been using for some time and I contacted the support on my Web Hosting Company and the were looking at my code and said it looked a little old.

They said I should change all $GLOBALS to $_SESSION

And also remove all session_register()

They didn’t tell me anything more, so I just want to know what it’s all about. Does anyone know why I should change this and what it does?

session_register has been deprecated: http://www.php.net/session_register

What they mean is; in old versions of PHP every the values are accessed with $GLOBAL array like of session. And the to register a session variable session_register function has to be used. But in newer version they don’t need and the functions are called deprecated. Now there are different (more easiest way too) like:


session_start();
//for sessions
$_SESSION['variablename']
// instead of
session_register('variablename');

And there are so many other things too which has to be considered and changed in new versions.