Session is used to save user data and when we close browser saved data is deleted. Session save the information about single user and that information is available on all pages in application. s
Session in php:
When we are running application on a PC our system knows who we are and when we start working and when we end but on internet no one knows. Therefore, to find out that information, we use sessions. Sessions are used to store data temporarily. We make a unique id variable for each user and store user data on that variable.
Session_start (); // for starting a session
Session_end (); // for ending a session
Remove or delete a Session in php:
To remove or delete a session in php we use the unset () or the session_destroy () built in function in php. Session_destroy function completely deletes or removes a session. And unset () function is also use to unset a session in php.
$_SESSION['foo'] = 'bar';
Above is a simple code to illustrate the basic use of unset () function to remove a session in php.
Above simple code uses session_destroy () function to remove a session in php.
This simple article tells that how we can remove or delete a session in php.