A session in php is started using session_start() function.
Globle variables (eg. $_SESSION.) are used for session variables.
Now we create a page “example_session.php” and start a session with some session variables :
Example
<?php
// Start the session
session_start();
?>
<!DOCTYPE html>
<html>
<body>
<?php
// Set session variables
$_SESSION[“country”] = “India”;
$_SESSION[“animal”] = “cat”;
echo “Session variables are set.”;
?>
</body>