Monday, 2 February 2015

Remove Sessions

To remove or delete session we use two function destroy and unset first use unset to remove all sessions and then destroy  example:


 
<!DOCTYPE html>

<html>
<body>

<?php
session_start();


$_SESSION['mysession1']='php-guides1';
$_SESSION['mysession2']='php-guides2';
$_SESSION['mysession3']='php-guides3';
$_SESSION['mysession4']='php-guides4';
$_SESSION['mysession5']='php-guides5';
?>

<p style="color:red">Session Values=<?php 
//Remove Or delete Sessions
session_unset();

session_destroy();

echo "<pre style='color:red'>";
print_r($_SESSION);
echo "</pre>";



?>

</p>


</body>
</html>



//print output

Session Values=
Array
(
)

No comments: