Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4033986
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T11:54:56+00:00 2026-05-20T11:54:56+00:00

I’m not sure if this is even possible, but I am trying to do

  • 0

I’m not sure if this is even possible, but I am trying to do a favourites list (using cookies). I can add/delete cookies using jquery and print out my cookies list using php fine. However, my cookie array has some things which I’m not interested in and I think some are variable so I can’t just unset it manually.

Here’s my cookie array:

Array
(
    [ys-vmconfiguration-active] => s:ext-comp-1005
    [94106e70fc3234ce511b7b9bd5d5d9b0] => 639b623be5a68913a11421e23de05559
    [6fb7ca7b058abd27041a8b41fed8f368] => 54 D575B4211 B 8 E4110165741 D 2 B 610 3415F 45914 050 B A F12 A46 D5D5B1B1250434714 A17561158105C56 81A53 15C A5843 F1B
    [d5e8a24a0ca709537c5c26b3134af3b5] => 46aac9d9a4d6c6a1a74c529a43dd4187
    [item_225] => 225
    [item_6] => 6
    [item_123] => 123
    [item_19] => 19
)

^^ Is there any way of getting all of the cookies that start with “item_” only?

So my new cookie array would be:

Array
(
    [item_225] => 225
    [item_6] => 6
    [item_123] => 123
    [item_19] => 19
)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T11:54:56+00:00Added an answer on May 20, 2026 at 11:54 am
    function has_item($key) {
       return strpos($key, 'item_') !== false;
    }
    $_COOKIE = array_flip(array_filter(array_flip($_COOKIE), 'has_item'));
    

    I tested this out using a php file on the command line and it worked. As for whether it will work with the browser, I can’t say for sure, but I don’t see why not. Another thing to consider is: is having those other cookies that bad? They are probably harmless tracking cookies.

    Anyway, an explanation: flip keys with values so the values are maintained. You cannot filter by keys, only values. Filter items that do not have “item_”. Then flip it back again so the keys and values are correct.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm not entirely sure how I managed to jack this up. http://pretty-senshi.com If you
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
This could be a duplicate question, but I have no idea what search terms
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
Does anyone know how can I replace this 2 symbol below from the string
Is it possible to replace javascript w/ HTML if JavaScript is not enabled on
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
For some reason, after submitting a string like this Jack’s Spindle from a text
I want to count how many characters a certain string has in PHP, but
Basically, what I'm trying to create is a page of div tags, each has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.