Sessions in PHP : Part 4 – Cleaning and destroying PHP session

The unset() function is used to unset or free a session variable that has been set. A session can be completely destroyed by using the session_destroy() function.
Example code:

<?php
unset($_SESSION['views']);
?>

All the stored data of the session will be deleted on calling the session_destroy() function.

Example code:


Tags:

Leave a Reply