How can one check if a session has been successfully deleted in PHP?

To check if a session has been successfully deleted in PHP, you can use the session_status() function to check the status of the session. If the session has been successfully deleted, the status should return PHP_SESSION_NONE. You can then use an if statement to check if the status is PHP_SESSION_NONE to confirm that the session has been deleted.

// Check if session has been successfully deleted
if(session_status() === PHP_SESSION_NONE){
    echo "Session has been successfully deleted.";
} else {
    echo "Session still exists.";
}