PHP » Cookies and Sessions » session_register()

Syntax:
bool session_register (mixed name [, mixed name2 ...])
name
The name of the session variables.

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.

Examples

Code:
<?php

session_start();
session_register("sess_var");
$sess_var = "value456";
print "sess_var: " . $sess_var;
session_unregister("sess_var");

?>
Output:
sess_var: value456
Explanation:

This is how to use session_register() if register_globals is enabled. See the other sample for an alternative method.

Code:
<?php

session_start();
$_SESSION["sess_var"] = "value123";
print "sess_var: " . $_SESSION["sess_var"];
unset($_SESSION["sess_var"]);

?>
Output:
sess_var: value123
Explanation:

As of PHP 4.1.0, this is the recommended way to register session variables.

See Also: