A PHP session is no different from a normal session. It can be used to store information on the server for future use. However this storage is temporary and is flushed out when the site is closed. Sessions can start by first creating a session id (unique) for each user.
A session is a logical object created by the PHP engine to allow you to preserve data across subsequent HTTP requests.
There is only one session object available to your PHP scripts at any time. Data saved to the session by a script can be retrieved by the same script or another script when requested from the same visitor.
Sessions are commonly used to store temporary data to allow multiple PHP pages to offer a complete functional transaction for the same visitor.
Syntax : session_start()
E.g. storing a customer’s information.
A PHP session starts using:
<?php session_start(); ?>
A PHP session variable is used to hold values of the current session. A session needs to be started first.
// store session data
They can be used to hold information about a single user that is applicable to all web pages