PHP has built-in session handling that is based on cookies. The default behavior is to create a cookie with the name PHPSESSID and it expires after the browser is closed. Data can be stored in PHP session by setting $_SESSION array to desired values.
Here are some functions related to PHP sessions:
setcookie($name, $value, $expire) - creates a new cookie with the given name, value and expiration date;
set_cookie($name, $value, $expire) - sets an existing cookie with the given name and value;
session_start() - starts a new PHP session;
session_destroy() - destroys a PHP session when it's no longer needed.