Difference between Cookies and Session in PHP
Posted by Raj
Difference between Cookies and Session in PHP
- Cookies are stored in the user’s browser memory.A cookie can keep information in the user's browser until deleted.
- Session : logical object that allows you to preserve data across subsequent http requests.Whenever PHP creates a new session, it generates a session ID.
- Session values are store in server side not in user’s machine. A session is available as long as the browser is opened. User couldn't be disabled the session.
- Cookies are stored in client side and sessions are stored in server side.
- Cookies can only store strings.We could store not only strings but also objects in session.
- we could be save cookie for future reference, but session couldn't. When users close their browser, they also lost the session.
This entry was posted on October 4, 2009 at 12:14 pm, and is filed under
Cookie in PHP,
difference between PHP session and cookie,
PHP,
PHP interview questions and answers,
PHP Session and Cookies,
Session in PHP,
Why use Cookie in PHP,
why use session in PHP
.You can leave a response, or trackback from your own site.