What are the potential alternatives to using session_destroy() to end a session?

When ending a session in PHP, an alternative to using session_destroy() is to unset all session variables and then invalidate the session cookie. This ensures that all data associated with the session is cleared and the session is effectively ended without destroying the session itself.

// Unset all session variables
$_SESSION = array();

// Invalidate the session cookie
if (isset($_COOKIE[session_name()])) {
    setcookie(session_name(), '', time()-42000, '/');
}

// Destroy the session
session_destroy();