/    Sign up×
Community /Pin to ProfileBookmark

Cookie Array

I’m looking to keep a list of selected tags in ‘memory’ while a user is active.

I was first thinking of using a COOKIE but you can’t have the value as an array. I don’t want to use sessions.

Other than making my array a string 12/23/22/43/45 and converting into and out of an array are there any other ideas?

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@NogDogJul 17.2020 — As long as there's some character you could use as a delimiter, it would seem simplest to implode() the array when putting it into the cookie, then explode() to pull it back into an array from the cookie. If that's not feasible (i.e. you cannot be sure any particular delimiter would be "safe"), then maybe use serialize() and unserialize(), instead?
Copy linkTweet thisAlerts:
@kiwisauthorJul 17.2020 — @NogDog#1620739

Yeah that's what I ended up doing.
×

Success!

Help @kiwis spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.7,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...