Skip to content

Commit

Permalink
Add session_unset()
Browse files Browse the repository at this point in the history
  • Loading branch information
joanhey committed Sep 10, 2023
1 parent fa79dc2 commit f2d3dbd
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/functions/AdapterSessionFunctions.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,19 @@ function session_regenerate_id(bool $delete_old_session = false): bool
return Http::sessionRegenerateId($delete_old_session);
}


/**
* Free all session variables
*
* @link https://www.php.net/manual/en/function.session-unset.php
*/
function session_unset(): bool
{
if(session_status() === PHP_SESSION_ACTIVE) {
$_SESSION = [];

return true;
}

return false;
}

0 comments on commit f2d3dbd

Please sign in to comment.