setcookie array php code example
Example 1: php array in cookie
// Storing code
setcookie('your_cookie_name', json_encode($info), time()+3600);
// Reading code
$data = json_decode($_COOKIE['your_cookie_name'], true);
Example 2: cookie are not set in php
setcookie('username',$username,time()+60*60*24*365);
// 'Force' the cookie to exists
$_COOKIE['username'] = $username;