Skip to content

Instantly share code, notes, and snippets.

@astorm
Created April 27, 2015 05:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save astorm/9f8297fe35171349f656 to your computer and use it in GitHub Desktop.
Save astorm/9f8297fe35171349f656 to your computer and use it in GitHub Desktop.
$value = array_key_exists('test', $_COOKIE) ? $_COOKIE['test'] : 0;
$value++;
setcookie('test', $value);
var_dump($value);
session_start();
$value = array_key_exists('test2', $_SESSION) ? $_SESSION['test2'] : 0;
$value = $value ? $value : 0;
$value++;
$_SESSION['test2'] = $value;
var_dump($value);
session_write_close();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment