Difference between Cookies and Session in PHP
Cookies are stored in the userâ€™s browser memory.A cookie can keep information in the user's browser until deleted.
Session : logical object that allows you to preserve data across subsequent http requests.Whenever PHP creates a new session, it generates a session ID.
Session values are store in server side not in userâ€™s machine. A session is available as long as the browser is opened. User couldn't be disabled the session.Â
Cookies are stored in client side and sessions are stored in server side.Â
Cookies can only store strings.We could store not only strings but also objects in session.
we could be save cookie for future reference, but session couldn't. When users close their browser, they also lost the session.