Code below:
$_SESSION = array();
Will it clear all session data? If I wouldn’t want to use session_destory().
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yup, it will destroy all session data but not the session itself.
Basically, there’s three elements to a session:
session_start()$_SESSION['foo'] = 'bar'So you are only destroying the session data.
session_destroy()destroys both the data and the session itself, but does not remove the session cookie.The only “real” difference between
$_SESSION = array()andsession_destroy()is that aftersession_destroy(), setting session data will not work anymore before initializing a new session.