Re: why manual says 'don't use session_register'?
| From: | Justin French | Date: | Tue, 24 Sep 2002 08:53:30 +0000 |
| Subject: | Re: why manual says 'don't use session_register'? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-117389@lists.php.net to get a copy of this message | ||
if you have register globals off, then use the $_SESSION array.
// set the value of a session var:
$_SESSION['foo'] = "bah";
// test to see if a session var is set
if(isset($_SESSION['foo'])) { ... }
// unset / unregister a session var
unset($_SESSION['foo']);
The older functions still work, but are not reliable, according to the
manual.
I much prefer working with $_SESSION, because session_register() was a
little counter-intuitive (IMO), and now doesn't work like the rest of the
superglobal arrays ($_POST, $_GET, etc).
If you have register globals off, I recommend working the new way.
Justin French
on 24/09/02 6:37 PM, Giancarlo Pinerolo (giancarlo@navigare.net) wrote:
> The manual has many cautions that say 'do not use session_regiister,,
> session_is_registered, session_unregister, when the ini setting is
> register_globals=off.
>
> But they still do work, it seems.
> Or how exactly do these function work differently than with reg_globals
> On?
> Can I still continue to use them with reg_globals=off, as they seem to
> work anyway?
>
> Gian