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
Or if you don’t care about the session at all, you could do
session_unsetorsession_destroy