Storing Array In Cookie and Retrieving it

  $arrNames= array('Name'=>'Mugil',
               	   'Email'=>'Mugil@cse.com', 
	           'ContactNo'=>'9962945097');
  
  $strDetails = implode(',', $arrNames);

  setcookie('Details', $strDetails, time()+ 3600*24);

  if(isset($_COOKIE['Details']))
  {
    $arrDetails = explode(',', $_COOKIE['Details']);
	
    for($i=0;$i<count($arrDetails);$i++)
     print $arrDetails[$i]."
"; }
Posted in PHP.

Leave a reply