Welcome to Smarter QA, Questions, Answers Community
Welcome to Smarter QA, where you can ask questions and receive answers from other members of the community. Ask anything that you want. Guests Posting are allowed.
+2 votes
34 views
asked in Wordpress by (1.1k points)

1 Answer

0 votes

Difference between Sessions and cookies in PHP.

Session - Session is a server-side resource that is associated with the cookies information. Session intact the cookies information and the cookies store user information under the client side. The session is not a client-side resource but the cookies are a client-side resource that stored the information under the browser (client side ). 

Cookies- Cookie is a client-side resource. We initiate it for store the login and another user information under the browser. When a user login using cookies and session the session associated with cookies information and log in the account. When the user logs out the account after that session has destroyed. If you close the window directly and log in again that time cookies help you to login account without filling your username and password( All user information+ ) .

Session

  • It is stored the unlimited amount of data.
  • It is holding the multiple variables in sessions.

Cookies - 

  • It is stored limit amount of data. It is only allowing 4kb[4096bytes]
  • It is not holding the multiple variable in cookies. 

Session - You have to need to start the session on every page. 

 The session is more secure because it is stored on the server, we can not easily access it. 

Cookies - You do not need start cookies in every page. 

Cookies are stored on the local computer (client side
) , basically, it maintains user identification means it tracks visitors record.. 

DIFFERENCE BETWEEN SESSION AND COOKIE.|Examples

answered by (2.4k points)
edited by
...