Possible Duplicate:
How to unset/destroy all session data except some specific keys?
I am having certain session variables starting with "cars" such as
$_SESSION["cars_registration"];
$_SESSION["cars_make"];
$_SESSION["cars_model"];
$_SESSION["cars_variant"];
.
.
.
$_SESSION["cars_date_created"];
I want to know the code for unsetting / deleting / emptying only those session variables which starts with cars as prefix like above.
So far I have achieved this but dont have any idea about code for unsetting them.
foreach($_SESSION as $key => $value)
{
if (strpos($key, 'cars_') === 0)
{
// Need to delete / unset the session variables
}
}
Please help me with it