Not sure if this is possible, but always worth a check before I give up on it.
Can sessions be “unset” based on matching a particular pattern?
EG: Say there are five session variables.
$_SESSION[‘bar_id’];
$_SESSION[‘foo_id’];
$_SESSION[‘foo_name’];
$_SESSION[‘foo_phone’];
$_SESSION[‘foo_email’];
Now let’s say I want to destroy all the “foo” sessions? Is there an easy way to unset (or null) those without taking out the “bar” session.
I know session_destroy() will take them all out, and I know I can manage each one independently with unset, or by re-assigning the value to Null, but I would love a solution to unset everything matching a condition.
@Shrapnel: Session are arrays - so yes, I guess I am using them That still doesn’t make me understand how to solve my problem.
@SpacePhoenix: In this example - I simply want to unset everything that has “foo” in the session name, but leave the rest (in this case with “bar”). I don’t want to (or need to) match the values of those variables, just the names.