This function has been deprecated as of PHP 5.3.0 and REMOVED as of PHP 5.4.0
Registers a session variable.
This function registers a session variable with the current session. It does not assign a value to the session variable.
This function is for use with register_globals enabled. For further information, see the section about Predefined Variables.
<?php
session_start();
session_register("sess_var");
$sess_var = "value456";
print "sess_var: " . $sess_var;
session_unregister("sess_var");
?>
sess_var: value456
This is how to use session_register() if register_globals is enabled. See the other sample for an alternative method.
<?php
session_start();
$_SESSION["sess_var"] = "value123";
print "sess_var: " . $_SESSION["sess_var"];
unset($_SESSION["sess_var"]);
?>
sess_var: value123
As of PHP 4.1.0, this is the recommended way to register session variables.