Latest Entries »

Friday, May 7, 2010

How to modify or remove php session variables

First you have to open the session for modify or remove session variables.
session_start();

To change a variable, just overwrite it.
$_SESSION['name']='your_name';

To remove a single variable in the session.
unset($_SESSION['name']);

To remove all the variables in the session. (without destroying the session)
session_unset();

To destroy the session.
session_destroy();

0 comments: