{"id":4594,"date":"2022-08-04T07:25:05","date_gmt":"2022-08-04T07:25:05","guid":{"rendered":"https:\/\/www.wikitechy.com\/interview-questions\/?p=4594"},"modified":"2022-08-04T07:25:05","modified_gmt":"2022-08-04T07:25:05","slug":"what-is-the-difference-between-session-and-cookies","status":"publish","type":"post","link":"https:\/\/www.wikitechy.com\/interview-questions\/php\/what-is-the-difference-between-session-and-cookies\/","title":{"rendered":"What is the difference between session and cookies ?"},"content":{"rendered":"<p><img fetchpriority=\"high\" decoding=\"async\" class=\"alignnone size-full wp-image-4595 aligncenter\" src=\"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/08\/session-vs-cookies.png\" alt=\"\" width=\"600\" height=\"439\" srcset=\"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/08\/session-vs-cookies.png 600w, https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/08\/session-vs-cookies-300x220.png 300w, https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/08\/session-vs-cookies-390x285.png 390w\" sizes=\"(max-width: 600px) 100vw, 600px\" \/><\/p>\n<table width=\"0\">\n<tbody>\n<tr>\n<td width=\"309\"><strong>\u00a0<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Session\u00a0 <\/strong><\/td>\n<td width=\"309\"><strong>\u00a0<\/strong><\/p>\n<p><strong>\u00a0<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Cookies<\/strong><\/td>\n<\/tr>\n<tr>\n<td width=\"309\">A temporary and interactive information interchange between two or more communicating devices or between a user and computer<\/td>\n<td width=\"309\">Small pieces of data sent from a website and stored on the user\u2019s computer by the user\u2019s web browser while the user is browsing<\/td>\n<\/tr>\n<tr>\n<td width=\"309\">\u00a0<\/p>\n<p>Stored in the server side<\/td>\n<td width=\"309\">\u00a0<\/p>\n<p>Stored in the client\u2019s browser as text files<\/td>\n<\/tr>\n<tr>\n<td width=\"309\">\u00a0<\/p>\n<p>It can store a large amount of data<\/td>\n<td width=\"309\">\u00a0<\/p>\n<p>It can store a minimum amount of data<\/td>\n<\/tr>\n<tr>\n<td width=\"309\">\u00a0<\/p>\n<p>It provides more security because it is difficult to access session values<\/td>\n<td width=\"309\">\u00a0<\/p>\n<p>It provides minimum security because it is easier to access cookie values<\/td>\n<\/tr>\n<tr>\n<td width=\"309\">\u00a0<\/p>\n<p>It holds multiple variables<\/td>\n<td width=\"309\">\u00a0<\/p>\n<p>It does not hold multiple variables<\/td>\n<\/tr>\n<tr>\n<td width=\"309\">\u00a0<\/p>\n<p>It is available until the browser is opened<\/td>\n<td width=\"309\">\u00a0<\/p>\n<p>It keeps the information until deleted by the user or set as per the timer<\/td>\n<\/tr>\n<tr>\n<td width=\"309\">\u00a0<\/p>\n<p>More reliable<\/td>\n<td width=\"309\">\u00a0<\/p>\n<p>Comparatively less reliable<\/td>\n<\/tr>\n<tr>\n<td width=\"309\">\u00a0<\/p>\n<p>Using session_destroy (), we will destroy sessions<\/td>\n<td width=\"309\">\u00a0<\/p>\n<p>Setting the cookie time to expire the cookie<\/td>\n<\/tr>\n<tr>\n<td width=\"309\">\u00a0<\/p>\n<p>Session depends on the cookie<\/td>\n<td width=\"309\">\u00a0<\/p>\n<p>Cookies does not depends on the cookie<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u00a0<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Session\u00a0 \u00a0 \u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Cookies A temporary and interactive information interchange between two or more communicating devices or between a user and computer Small pieces of data sent from a website and stored on the user\u2019s computer by the user\u2019s web browser while the user is browsing \u00a0 Stored in the server [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8182],"tags":[17820,17818,17816,17823,17821,17826,17824,17825,17817,17819,17822,17815],"class_list":["post-4594","post","type-post","status-publish","format-standard","hentry","category-php","tag-difference-between-a-cookie-and-a-session","tag-difference-between-cookie-and-session","tag-difference-between-session-and-cookies","tag-difference-between-session-and-cookies-in-php","tag-difference-between-session-and-cookies-php","tag-select-correct-statement-regarding-session-and-cookies","tag-session-and-cookies-in-servlet","tag-session-vs-cookie-vs-local-storage","tag-session-vs-cookies","tag-what-are-the-difference-between-sessions-and-cookies","tag-what-is-session-and-cookies-explain-in-detail-with-an-example","tag-what-is-the-difference-between-session-and-cookies"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>What is the difference between session and cookies ?<\/title>\n<meta name=\"description\" content=\"What is the difference between session and cookies ? - Session Vs Cookies - A temporary and interactive information interchange between two or more communicating devices.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wikitechy.com\/interview-questions\/php\/what-is-the-difference-between-session-and-cookies\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"What is the difference between session and cookies ?\" \/>\n<meta property=\"og:description\" content=\"What is the difference between session and cookies ? - Session Vs Cookies - A temporary and interactive information interchange between two or more communicating devices.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wikitechy.com\/interview-questions\/php\/what-is-the-difference-between-session-and-cookies\/\" \/>\n<meta property=\"og:site_name\" content=\"Wikitechy\" \/>\n<meta property=\"article:published_time\" content=\"2022-08-04T07:25:05+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/08\/session-vs-cookies.png\" \/>\n<meta name=\"author\" content=\"webmaster\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"webmaster\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/php\\\/what-is-the-difference-between-session-and-cookies\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/php\\\/what-is-the-difference-between-session-and-cookies\\\/\"},\"author\":{\"name\":\"webmaster\",\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/#\\\/schema\\\/person\\\/f785ba3ecc599133e65ab6138042a3e4\"},\"headline\":\"What is the difference between session and cookies ?\",\"datePublished\":\"2022-08-04T07:25:05+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/php\\\/what-is-the-difference-between-session-and-cookies\\\/\"},\"wordCount\":190,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/php\\\/what-is-the-difference-between-session-and-cookies\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/session-vs-cookies.png\",\"keywords\":[\"difference between a cookie and a session\",\"difference between cookie and session\",\"Difference between Session and Cookies\",\"difference between session and cookies in php\",\"difference between session and cookies php\",\"select correct statement regarding session and cookies\",\"session and cookies in servlet\",\"session vs cookie vs local storage\",\"Session vs cookies\",\"what are the difference between sessions and cookies\",\"what is session and cookies explain in detail with an example\",\"What is the difference between session and cookies ?\"],\"articleSection\":[\"PHP\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/php\\\/what-is-the-difference-between-session-and-cookies\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/php\\\/what-is-the-difference-between-session-and-cookies\\\/\",\"url\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/php\\\/what-is-the-difference-between-session-and-cookies\\\/\",\"name\":\"What is the difference between session and cookies ?\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/php\\\/what-is-the-difference-between-session-and-cookies\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/php\\\/what-is-the-difference-between-session-and-cookies\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/session-vs-cookies.png\",\"datePublished\":\"2022-08-04T07:25:05+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/#\\\/schema\\\/person\\\/f785ba3ecc599133e65ab6138042a3e4\"},\"description\":\"What is the difference between session and cookies ? - Session Vs Cookies - A temporary and interactive information interchange between two or more communicating devices.\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/php\\\/what-is-the-difference-between-session-and-cookies\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/php\\\/what-is-the-difference-between-session-and-cookies\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/session-vs-cookies.png\",\"contentUrl\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/session-vs-cookies.png\",\"width\":600,\"height\":439},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/#website\",\"url\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/\",\"name\":\"Wikitechy\",\"description\":\"Interview Questions\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/#\\\/schema\\\/person\\\/f785ba3ecc599133e65ab6138042a3e4\",\"name\":\"webmaster\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/155b77fd8cdda3d0913fcb7e7ee63543b0c345d2d8f6dcebda5b0583ab61f967?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/155b77fd8cdda3d0913fcb7e7ee63543b0c345d2d8f6dcebda5b0583ab61f967?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/155b77fd8cdda3d0913fcb7e7ee63543b0c345d2d8f6dcebda5b0583ab61f967?s=96&d=mm&r=g\",\"caption\":\"webmaster\"},\"sameAs\":[\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\"],\"url\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/author\\\/webmaster\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"What is the difference between session and cookies ?","description":"What is the difference between session and cookies ? - Session Vs Cookies - A temporary and interactive information interchange between two or more communicating devices.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wikitechy.com\/interview-questions\/php\/what-is-the-difference-between-session-and-cookies\/","og_locale":"en_US","og_type":"article","og_title":"What is the difference between session and cookies ?","og_description":"What is the difference between session and cookies ? - Session Vs Cookies - A temporary and interactive information interchange between two or more communicating devices.","og_url":"https:\/\/www.wikitechy.com\/interview-questions\/php\/what-is-the-difference-between-session-and-cookies\/","og_site_name":"Wikitechy","article_published_time":"2022-08-04T07:25:05+00:00","og_image":[{"url":"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/08\/session-vs-cookies.png","type":"","width":"","height":""}],"author":"webmaster","twitter_card":"summary_large_image","twitter_misc":{"Written by":"webmaster","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.wikitechy.com\/interview-questions\/php\/what-is-the-difference-between-session-and-cookies\/#article","isPartOf":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/php\/what-is-the-difference-between-session-and-cookies\/"},"author":{"name":"webmaster","@id":"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/f785ba3ecc599133e65ab6138042a3e4"},"headline":"What is the difference between session and cookies ?","datePublished":"2022-08-04T07:25:05+00:00","mainEntityOfPage":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/php\/what-is-the-difference-between-session-and-cookies\/"},"wordCount":190,"commentCount":0,"image":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/php\/what-is-the-difference-between-session-and-cookies\/#primaryimage"},"thumbnailUrl":"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/08\/session-vs-cookies.png","keywords":["difference between a cookie and a session","difference between cookie and session","Difference between Session and Cookies","difference between session and cookies in php","difference between session and cookies php","select correct statement regarding session and cookies","session and cookies in servlet","session vs cookie vs local storage","Session vs cookies","what are the difference between sessions and cookies","what is session and cookies explain in detail with an example","What is the difference between session and cookies ?"],"articleSection":["PHP"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.wikitechy.com\/interview-questions\/php\/what-is-the-difference-between-session-and-cookies\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.wikitechy.com\/interview-questions\/php\/what-is-the-difference-between-session-and-cookies\/","url":"https:\/\/www.wikitechy.com\/interview-questions\/php\/what-is-the-difference-between-session-and-cookies\/","name":"What is the difference between session and cookies ?","isPartOf":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/php\/what-is-the-difference-between-session-and-cookies\/#primaryimage"},"image":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/php\/what-is-the-difference-between-session-and-cookies\/#primaryimage"},"thumbnailUrl":"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/08\/session-vs-cookies.png","datePublished":"2022-08-04T07:25:05+00:00","author":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/f785ba3ecc599133e65ab6138042a3e4"},"description":"What is the difference between session and cookies ? - Session Vs Cookies - A temporary and interactive information interchange between two or more communicating devices.","inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wikitechy.com\/interview-questions\/php\/what-is-the-difference-between-session-and-cookies\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.wikitechy.com\/interview-questions\/php\/what-is-the-difference-between-session-and-cookies\/#primaryimage","url":"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/08\/session-vs-cookies.png","contentUrl":"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/08\/session-vs-cookies.png","width":600,"height":439},{"@type":"WebSite","@id":"https:\/\/www.wikitechy.com\/interview-questions\/#website","url":"https:\/\/www.wikitechy.com\/interview-questions\/","name":"Wikitechy","description":"Interview Questions","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wikitechy.com\/interview-questions\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/f785ba3ecc599133e65ab6138042a3e4","name":"webmaster","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/155b77fd8cdda3d0913fcb7e7ee63543b0c345d2d8f6dcebda5b0583ab61f967?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/155b77fd8cdda3d0913fcb7e7ee63543b0c345d2d8f6dcebda5b0583ab61f967?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/155b77fd8cdda3d0913fcb7e7ee63543b0c345d2d8f6dcebda5b0583ab61f967?s=96&d=mm&r=g","caption":"webmaster"},"sameAs":["https:\/\/www.wikitechy.com\/interview-questions"],"url":"https:\/\/www.wikitechy.com\/interview-questions\/author\/webmaster\/"}]}},"_links":{"self":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts\/4594","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/comments?post=4594"}],"version-history":[{"count":1,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts\/4594\/revisions"}],"predecessor-version":[{"id":4596,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts\/4594\/revisions\/4596"}],"wp:attachment":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/media?parent=4594"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/categories?post=4594"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/tags?post=4594"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}