What is Session and How to use Session?

PHP

When you open any Link into Browser and once you close the Browser. Browser detect user with the details and those Details are called as session.
Session store User information for all the links you opened.
Session store all the different information for all the different links or logged in done into other links.
Session variables are set with the PHP global variable: $_SESSION.
A SESSION is defined as a server-side storage of information that is desired to persist throughout the user’s interaction with the any of the Web Site on any of the web applications.
In place of storring large information via cookies in the user’s browser, only a unique identifier is stored on the client side (called a “session id”).
This session id is passed to the server each time and the browser makes an HTTP request (ie a page link or AJAX request).
The web application pairs this session id with it’s internal database and retrieves the stored variables for use by the requested page.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
        <title>Session in PHP : Example in PHP</title>
    </head>
    <body>
        <?php
            // Start the session
            session_start();
        ?>
        <!DOCTYPE html>
        <html>
            <body>

                <?php
                    // Set session variables
                    $_SESSION["firstname"] = "John";
                    $_SESSION["lastname"] = "Doe";
                    echo "Session variables are set.";
                ?>
                <?php
                    // Echo session variables that were set on previous page
                    echo "First Name is " . $_SESSION["firstname"] . ".<br>";
                    echo "Last Name is " . $_SESSION["lastname"] . ".";
                ?>
                <?php
                    // To check all the Session Variables 
                    print_r($_SESSION);
                ?>
                <?php
                    // Update Session Variable
                    $_SESSION["firstname"] = "Jaz";
                    print_r($_SESSION);
                ?>

                <?php
                    // Remove All the Session Variable
                    session_unset();

                    // Destroy All Session Variables
                    session_destroy();
                ?>

            </body>
        </html>

    </body>
</html>
-->