In PHP Session, information or data is stored on the server side. Each session is associated with sessionID. PHP Session is created using $_SESSION variable and start with session_start() function. Session also overcomes many drawbacks related with the Cookies like Cookies are not much secure as using form data and query strings.
Any hacker can easily change a cookie's contents in order to destroy your application and even affect your hardware badly while in case of a session, SIDs generated by PHP are unique and impossible to guess or access and hence it is very difficult for a hacker to access and affect the session data. You can store more data in a session as compared to a cookie.
Syntax
Syntax
Syntax
Syntax:
Change Value of Variable in a Session Example
This will produce following result
Syntax
Remove Variables in a Session Example
Syntax