Delete/Destroy session PHP

You can delete / Destroy session using the PHP function unset()

Example

<?php
session_start();
if(isset($_SESSION[‘phpcodez_views’]))
unset($_SESSION[‘phpcodez_views’]);
?>

Also its possible to completely delete the data using the function session_destroy ()

Example
<?php
session_destroy();
?>

Leave a Reply

Your email address will not be published. Required fields are marked *