session_register() vs $_SESSION
Posted: Fri Aug 22, 2003 11:13 am
Ok ... I've read every last scrap of documentation on the session functions, and $_SESSION, and am trying to get into the nuances of the differences between the two.
To my eye, the only real difference between
and
is that in the first example $foo is local, while it has become global (as $_GLOBAL['foo']?) in the second one. Or am I missing some subtle behaviour that they don't tell you about in the documentation?
Putting aside personal preference, and provided that all data is validated, how can using the superglobal $_SESSION be better than, or 'recommended' over creating a global with session_register()?
To my eye, the only real difference between
Code: Select all
session_start();
$foo = $_POST['foo'];
$_SESSION['foo'] = $variable;Code: Select all
session_start();
$foo = $_POST['foo'];
session_register('foo');Putting aside personal preference, and provided that all data is validated, how can using the superglobal $_SESSION be better than, or 'recommended' over creating a global with session_register()?