WHAT IS THE DIFFERENCE BETWEEN SESSIONS AND COOKIES IN PHP?
- Cookies are stored in browser as text file format.
- It is stored limit amount of data. It is only allowing 4kb[4096bytes]
- It is not holding the multiple variable in cookies.
- We can accessing the cookies values in easily. So it is less secure.
- The setcookie() function must appear BEFORE the tag.
- If we Closing the browsers at the time.
- Setting the cookie time to expire the cookie.
- Sessions are stored in server side.
- It is stored unlimited amount of data.
- It is holding the multiple variable in sessions.
Destroy Sessions :
- Using unset() session, we will destroyed the sessions.
- Using session_destory(), we we will destroyed the sessions.