I know that in PHP there are two superglobal variables $_COOKIE
and $_SESSION
, but how do they work, in fact? And what do they stand for my application?
I know that in PHP there are two superglobal variables $_COOKIE
and $_SESSION
, but how do they work, in fact? And what do they stand for my application?
Quickly, $ _SESSION and $ _COOKIES are used to store information.
$ _SESSION stores the information on the server, so it is safer and generally used for logins and passwords.
$ _COOKIES stores the information in your user's browser and is most often used to store user preferences, shopping cart, etc.