acctman
acctman

Reputation: 4349

Clear a two dimensional session array

I'd like to clear a specific session, how would I go about doing that.

$_SESSION['files'][]

Upvotes: 4

Views: 3491

Answers (4)

Rahul Chordiya
Rahul Chordiya

Reputation: 542

unset($_SESSION['files']);
use this...

Upvotes: 1

Starx
Starx

Reputation: 78971

On addition to above answers, you can remove multiple session variables at once.

unset($_SESSION['file'],$_SESSION['image'],$_SESSION['video']);

Upvotes: 3

Pascal MARTIN
Pascal MARTIN

Reputation: 400952

You could unset the entry you want to remove :

unset($_SESSION['files']);

This will completely remove the 'files' entry from the $_SESSION array.

Upvotes: 5

Haim Evgi
Haim Evgi

Reputation: 125476

if you want to unset all the array is :

unset ($_SESSION['files']);

if you want only specific entry to unset is

 unset ($_SESSION['files'][entry]);

Upvotes: 9

Related Questions