note 87525 added to function.setcookie
| From: | Frank at osu1 dot php dot net | Date: | Tue, 09 Dec 2008 03:22:02 +0000 |
| Subject: | note 87525 added to function.setcookie | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-147929@lists.php.net to get a copy of this message | ||
One note on storing information in an "array" in a cookie:
You CANNOT access that array as a normal array.
So for example if you store:
setcookie("cookie[three]", "cookiethree");
setcookie("cookie[two]", "cookietwo");
setcookie("cookie[one]", "cookieone");
$_COOKIE[cookie][one] returns nothing.
You MUST use foreach to grab all the information listed in the example above.
Not sure if this is a bug in php or a "feature."
Hopefully, this can save others some time.
----
Server IP: 64.71.164.2
Probable Submitter: 99.2.75.186
----
Manual Page -- http://www.php.net/manual/en/function.setcookie.php
Edit -- https://master.php.net/note/edit/87525
Del: integrated -- https://master.php.net/note/delete/87525/integrated
Del: useless -- https://master.php.net/note/delete/87525/useless
Del: bad code -- https://master.php.net/note/delete/87525/bad+code
Del: spam -- https://master.php.net/note/delete/87525/spam
Del: non-english -- https://master.php.net/note/delete/87525/non-english
Del: in docs -- https://master.php.net/note/delete/87525/in+docs
Del: other reasons-- https://master.php.net/note/delete/87525
Reject -- https://master.php.net/note/reject/87525
Search -- https://master.php.net/manage/user-notes.php