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 8949965
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:20:32+00:00 2026-06-15T13:20:32+00:00

I really not getting how to do this From PHP Manual Cookies names can

  • 0

I really not getting how to do this

From PHP Manual

Cookies names can be set as array names and will be available to your
PHP scripts as arrays but separate cookies are stored on the user’s
system.

This is okay to me and I got and could use like below

setcookie("cookie[three]", "cookiethree");
setcookie("cookie[two]", "cookietwo");

But this method will create multiple cookies and that is I don’t want

PHP manual also says

Consider explode() to set one cookie with multiple names and
values.

But I did not get how to use explode to set one cookie with multiple names and values?

Please someone explain this.

But not getting this

  • 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-06-15T13:20:33+00:00Added an answer on June 15, 2026 at 1:20 pm

    Cookies are nothing else than a dumb key/value storage system. It’s as simple as that.

    It happens that PHP offers a nifty feature on top of that: cookies whose names contain square brackets in the described format will be combined into a single array variable when reading cookies back from PHP. But that’s the only exception, it doesn’t affect the way cookies work and, as you’ve said, it’s a feature you don’t need.

    Said that, you only need to think of the cookie value as a whiteboard where you can put anything you want, as long as it’s text. And there’re many PHP functions that allow you to convert exotic stuff like arrays into plain text:

    • serialize()
    • json_encode()
    • implode()
    • …

    Use your imagination and you’re done 😉

    Update: A little remark—I’ve mentioned serialize() for completeness, but it’s probably not worth the effort since it’d be very complicate to ensure you don’t open the door to code injection.

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

Sidebar

Related Questions

I'm not really getting how this code does what it does: char shellcode[] =
I feel like this might be really simple but I'm just not getting it
I am migrating my site from PHP 4 to 5 I keep getting this
Hi I am from PHP background and in am not really very familiar with
Really simple but just not getting it. I want to reference a view by
I'm not sure if I'm missing something really obvious, but I keep getting a
I'm really not sure what it is (if it's an array of pointers, or
I realize this is a very generic question, but I guess I'm not really
I really hope someone can help with this problem. I have an ajax pagination
I've got the following code from php.net: $GLOBALS['normalizeChars'] = array( 'Š'=>'S', 'š'=>'s', 'Ð'=>'Dj','Ž'=>'Z', 'ž'=>'z',

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.