What are the differences between session and cookie?



What are the differences between session and cookie?..

Answer / Laeek Ahmad

PHP Sessions and Cookies are both used for storing data temporarily, but they have some key differences:
1. Storage: Sessions are stored on the server, while cookies are stored on the client's browser.
2. Data Lifetime: Sessions typically last until the user logs out or the browser is closed, while cookies can persist for a longer duration depending on their settings.
3. Security: Sessions are more secure because data isn't sent to the client, whereas cookie data is sent with each request.
4. Session ID: Each session is identified by a unique session ID, which is stored in a cookie or URL parameter, while cookies can be used to store arbitrary data.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More PHP Interview Questions

How can I use the COM components in php?

1 Answers   Covansys, Rushmore Consultancy,


What is the correct php command to use to catch any error messages within the code?

1 Answers  


What are the string functions in php?

1 Answers  


What is the best php framework 2018?

1 Answers  


Which have the fastest execution between mysql_fetch_array() and mysql_fetch_assoc()

1 Answers  


How can we get the browser properties using PHP?

4 Answers   Google, Pollux Softech,


How to create the PHP Script to Calculate the Age Using the Inputs Of our Birth date and the Current date?

6 Answers  


How can we submit a form without a submit button?

4 Answers   Agile Software,


What does odbc do in context with php?

1 Answers  


Explain the difference between isset() and empty()?

1 Answers  


How can I execute a PHP script using command line?

4 Answers   Sify,


Which php framework is best?

1 Answers  


Categories