diff --git a/class.Session.php b/class.Session.php index 514fa0e..5e83ae0 100644 --- a/class.Session.php +++ b/class.Session.php @@ -79,6 +79,20 @@ public function set($key, $value = null) $_SESSION[$this->sessionId] = json_encode($this->session); } + + /** + * Delete a session variable by key. + * + * @param string $key + */ + public function delete($key) + { + if(isset($this->session[$key])) { + unset($this->session[$key]); + } + + $_SESSION[$this->sessionId] = json_encode($this->session); + } /** * Destroy the entire session variables.