raji20 Posted November 8, 2006 Share Posted November 8, 2006 Hello Guys, Hope u all are doing great. Can you suggest me how to write a array in the cookie, for eg,[code=php:0] $var = array("1","2","3"); [/code]Now I want to set a cookie which should store this array $var. I dont want to use for loop for storing the array value in the cookieCan anyone help me............Thanks a lot in advance Link to comment https://forums.phpfreaks.com/topic/26556-how-to-write-a-array-in-the-cookie/ Share on other sites More sharing options...
HuggieBear Posted November 8, 2006 Share Posted November 8, 2006 Just use [code=php:0]$_SESSION['var'] = $var;[/code] after you've assigned the array to $var.RegardsHuggie Link to comment https://forums.phpfreaks.com/topic/26556-how-to-write-a-array-in-the-cookie/#findComment-121478 Share on other sites More sharing options...
Zane Posted November 8, 2006 Share Posted November 8, 2006 the serialize() function is meant just for this situationhttp://www.php.net/serialize$var = array("1","2","3");$_SESSION['myVar'] = serialize($var); Link to comment https://forums.phpfreaks.com/topic/26556-how-to-write-a-array-in-the-cookie/#findComment-121553 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.