note 87525 deleted from function.setcookie by aharvey
| From: | aharvey@php.net | Date: | Thu, 14 Mar 2013 17:00:08 +0000 |
| Subject: | note 87525 deleted from function.setcookie by aharvey | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-194075@lists.php.net to get a copy of this message | ||
Note Submitter: Frank
----
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:
<?php
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.