I have a small script that sets multiple cookies, they all have this format item_1928 item_3847 item_5782 etc.
I need to get all the values for the cookies that start with item and store them in an array.
Here’s is some code I found on SO but I’m not sure it’s what I’m looking for. It just stores the key, but not the values:
$matches = array();
foreach($_COOKIE as $key => $value) {
if(substr($key, 0, 20) == 'wordpress_logged_in_') {
$matches[] = $key;
}
}
You can try this: