I\'m using some $_SESSION
variables for filtering many query records that have a similar name (ex. $_SESSION[\'nameFilter\']
or $_SESSION[\'cityF
Assuming your keys always cointain the string Filter
you can check for it.
I suggest you to take a look at the strpos function which checks if a given needle is cointaned in a string and returns the null
in case it's not found or the position of where the needle starts in that string.
Then you only have to go through the session variables and unset the ones containing the word Filter
foreach($_SESSION as $key => $value){
if (strpos($key, 'Filter') !== false) {
unset($_SESSION[$key]);
}
}
Hope this helps :)