Destroying a session : session_destroy « Cookie Session « PHP






Destroying a session

 
<?php
session_start(  );

$_SESSION['username'] = 'Michele';

session_destroy(  );
echo "At this point we can still see the value of username as ";
echo $_SESSION['username']."<br />";

unset ($_SESSION['username');
if (is_null($_SESSION['username'])) {
    echo "Now the value of username is (blank)";
}
?>
  
  








Related examples in the same category

1.Ending a Session
2.function session_destroy() ends all persistent data corresponding to the current user session.