How can a single session variable be deleted in PHP?

To delete a single session variable in PHP, you can use the unset() function to unset the specific session variable that you want to delete. This function removes the variable from the $_SESSION superglobal array, effectively deleting it from the session.

<?php
session_start();

// Set a session variable
$_SESSION['example_var'] = 'value';

// Delete a specific session variable
unset($_SESSION['example_var']);
?>