In PHP, a session provides a way to save the preferences of visitors to a web page on a web server in the form of variables that can be used on multiple pages.
Suppose we have a two pages one page to store session another to access the session is available on every pages of your website in PHP
Whenever you need to use a session first thing we need to start session then we can do operation on a session
<?php session_start(); $_SESSION['data'] = "my session data";
How to access session data?
We had store data on index.php file now we will access that session in aoother page which is access.php
<?php session_start(); echo $_SESSION['data'];
|my session data|