Session¶
Session support in PHP consists of a way to preserve certain data across subsequent accesses.
It relies on the session_*
functions, and the $_SESSION
superglobal variable.
<?php
if (isset($_SESSION['x'])) {
print "x was already set with the value ".$_SESSION['x'];
}
$_SESSION['x'] = rand(0, 10);
print "Giving the value ".$_SESSION['x']." to x, in the session\n";
?>
See also Session in PHP: Creating, Destroying, and Working With Session in PHP
Related : Superglobal Variables