setcookie code example

Example 1: setcookie php

setcookie($cookiename, $cookievalue, time() + (86400 * 30), "/"); // 86400 = 1 day

Example 2: php set cookie

<?php
  $name = 'COOKIE_NAME';
  $value = 'VALUE';
  $expireTime = strtotime('+1 years');
  $path = '/';
  setcookie($name,$value,$expireTime,$path);

Example 3: cookies php syntax

setcookie("cookie_name", "type_on_cookie", expiry_time(), "/");

Example 4: php page sends cookie to visitor

<?php $Month = 2592000 + time();//this adds 30 days to the current timesetcookie(UserVisit, date("F jS - g:i a"), $M

Tags:

Php Example