different between session and cookies

Sesstion :

– Sessions are server-side files that contain user information
– Session Max life time is 24 Minutes as defined in php.ini
$_SESSION super global variable is used to manage session.
– Before using $_SESSION, you have to write session_start(); In that way session will start and you can access $_SESSION variable on that page.
– You can store as much data as you like within in sessions.The only limits you can reach is the maximum memory a script can consume at one time, which by default is 128MB.

Cookies:
– Cookies are client-side files that contain user information
– We have to set cookie max life time manually with php code
– In php $_COOKIE super global variable is used to manage cookie.
– You don’t need to start Cookie as It is stored in your local machine.
– Official MAX Cookie size is 4KB

Related posts