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 Quote 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 Quote 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); Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.