I have 55 session variables
and want to unset 54
of them. They all begin with sv
and the one that I want to keep begins with nb
I tried to do this but to no avail. Does anybody have any suggestions?
foreach($_SESSION as $key => $val)
{
if ($key !== 'nb')
{
unset($_SESSION[$key]);
}
}
I was thinking to use a loop
to unset
them instead of typing unset(variable) 54 times