PHP / MySQL

  1. Home
  2. Computing & Technology
  3. PHP / MySQL

Session_unset () PHP Function

By Angela Bradley, About.com

Definition: Session_unset () is used to remove all variables in a session. You must first open a session to use session_unset (). You should use this function instead of unset($_session) to remove the entire session, to avoid problems with global variables. It should usually be used with session_destroy() to more thoroughly remove the session, if that is your goal.
Also Known As: Remove Session Variables
Examples:
<?php
// you have to open the session to be able to modify or remove it
session_start();

// or this would remove all the variable in the session
session_unset();

//destroy the session
session_destroy();
?>

Explore PHP / MySQL

About.com Special Features

Build Your Own Website

Step-by-step advice on how to do everything from choosing a Web host to promoting your content. More >

Connect Your Home Computers

Easy ways to connect two computers for networking purposes. More >

PHP / MySQL

  1. Home
  2. Computing & Technology
  3. PHP / MySQL
  4. PHP Functions
  5. Session Unset - PHP Session Unset - Unset Variables PHP Session

©2009 About.com, a part of The New York Times Company.

All rights reserved.