How can a PHP session be properly cleared or destroyed in a script?
To properly clear or destroy a PHP session in a script, you can use the `session_unset()` function to remove all session variables and then call `session_destroy()` to destroy the session itself. This will effectively end the session and remove all session data.
<?php
session_start(); // Start the session
// Clear all session variables
$_SESSION = array();
// Destroy the session
session_destroy();
?>