Can you provide an example of securely managing and deleting session variables in PHP?

When managing session variables in PHP, it's important to ensure that sensitive data is securely stored and deleted when no longer needed to prevent unauthorized access. One way to securely manage and delete session variables is by using the session_unset() function to remove specific session variables once they are no longer needed.

// Start the session
session_start();

// Set a session variable
$_SESSION['user_id'] = 123;

// Use the session variable

// Unset the session variable when no longer needed
unset($_SESSION['user_id']);

// Destroy the session
session_destroy();