I'm using named sessions to store variables for a multi-page form like this:
$_SESSION['pages'][0]
$_SESSION['pages'][1]
If I want to unset all the variables in $_SESSION['pages'][1] and I use session_unset(); it clears all the variables in both of them.
I know I can unset variables one by one using:
unset($_SESSION['pages'][1]['email'])
But I'm looking for a way to delete all of $_SESSION['pages'][1]
while leaving $_SESSION['pages'][0]
intact
You can use unset
on $_SESSION['pages'][1]
, it's just a normal Array.
unset($_SESSION['pages'][1]);