I am trying to unset a session from $_SESSION with the following function:
public function unsetSession($s) {
if (is_array($s)) {
$temp = &$_SESSION;
foreach ($s as $value) {
if (isset($temp[$value])) {
$temp = &$temp[$value];
}
else {
return false;
}
}
unset($temp);
return true;
}
}
I call it like this unsetSession(array("key1", "key2", "etc."));.
However, it doesn't work and the session will not be deleted. What am I missing?
Thank you in advance!