Skip to content

Instantly share code, notes, and snippets.

@susanBuck
Created February 21, 2014 12:19
Show Gist options
  • Save susanBuck/9133317 to your computer and use it in GitHub Desktop.
Save susanBuck/9133317 to your computer and use it in GitHub Desktop.
Sessions example
/*-------------------------------------------------------------------------------------------------
Set session helper
-------------------------------------------------------------------------------------------------*/
public static function set_session($key,$value = NULL) {
$_SESSION[$key] = $value;
}
/*-------------------------------------------------------------------------------------------------
Get session helper
-------------------------------------------------------------------------------------------------*/
public static function get_session($key, $unset = true) {
if(isset($_SESSION[$key])) {
$value = $_SESSION[$key];
if($unset) unset($_SESSION[$key]);
return $value;
}
return NULL;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment