Learning PHP and MySQL

Example 13-15 Destroying a session

<?php session_start();
//  Do  some  miscellaneous  work
$_SESSION['username']  =  'Michele';
//  Logout  of  the  site session_destroy();
echo  "At  this  point  we  can  still  see  the  value  of  username  as
"
.$_SESSION['username']."<br  />";
$_SESSION  =  array();
echo  
"Now  the  value  of  username  is  blank:  ".$_SESSION['username'];
?>

Posted by on 09/25 at 11:44 AM

Next entry: Example 13-16 Session timeout

Previous entry: Example 13-14 Checking to see whether a user is valid

<< Back to main