I got some cookie start by XYZ and I want to unset them when the user access to a specific route.
So I code :
foreach ($_COOKIE as $key => $value)
if (preg_match('/^XYZ/', $key))
unset($_COOKIE[$key]);
But the cookies still there. I really don't understand because when I do :
foreach ($_COOKIE as $key => $value)
if (preg_match('/^XYZ/', $key))
echo($_COOKIE[$key]);
... it works. So I wonder if it is possible to unset cookies like above.
reset a cookie like:
You can try this -
With
preg_match
-