I have a tricky question. lets say if we start naming session as :
$_SESSION['user-msg'], $_SESSION['user-err'], $_SESSION['user-name'], $_SESSION['admin-msg'], $_SESSION['admin-err'], $_SESSION['admin-username']
what if i just want to destroy session those are having key as "user-" only? how we do that?
actually i want to log out admin (backend) only. while the same person is logged in as user on my front end.
Something like this:
$prefix='user-';
foreach($_SESSION as $key => $val)
if (substr($key, 0, strlen($prefix)) === $prefix)
unset($_SESSION[$key]);
I don't think there exists any better option.