如何取消设置PHP中的数组_SESSION变量

I have a certain session variable that is actually an array. I want to delete the entire array variable but cannot make it happen.

_SESSION VAR

$_SESSION['auth']['id']
$_SESSION['auth']['username']
$_SESSION['auth']['role']

I tried unset($_SESSION['auth']) but it does not work. Do I need to unset each 2nd level array individually using unset()?

Thanks.

unset should be working :S As Artjom Kurapov also pointed out, it might have to due with the session not being started.

But anyhow, have you tried just doing

$_SESSION['auth'] = array();

Or if you don't care about the session at all, you could do session_unset or session_destroy

Maybe you don't have session_start() somewhere before?