PHP session_destroy() Function
What is session_destroy Function?
How to end or destroy session data in PHP?
The "session_destroy()" function destroys all data registered to a session.
Usually the session_destroy is called to end the session when the browser is closed, unlike cookies which have a specific time to end the session.
$_SESSION = array();
In the above example first the session_start() is called and then an empty array is called, only then the session_destroy() is called, if session_start is not called the other two statements may not execute properly.