What potential issue could arise when using the session_destroy() function in PHP?
When using the session_destroy() function in PHP, it is important to note that it only destroys the current session data, but does not unset the session cookie. This can potentially lead to the session being re-initialized if the cookie is still present. To fully destroy the session, you should also unset the session cookie by setting its expiration time to a past value.
session_start();
$_SESSION = array();
session_destroy();
setcookie(session_name(), '', time() - 3600, '/');