{"id":190,"date":"2009-02-24T17:27:55","date_gmt":"2009-02-24T21:27:55","guid":{"rendered":"http:\/\/blogs.n1zyy.com\/andrew\/?p=190"},"modified":"2009-02-24T17:27:55","modified_gmt":"2009-02-24T21:27:55","slug":"instant-storage","status":"publish","type":"post","link":"https:\/\/blogs.n1zyy.com\/andrew\/2009\/02\/24\/instant-storage\/","title":{"rendered":"Instant Storage"},"content":{"rendered":"<p>Here&#8217;s one of my favorite PHP &#8216;hacks&#8217;: when I&#8217;m whipping up a quick script that needs a place to stash some persistent data, but don&#8217;t feel like coming up with a database structure, or doing anything remotely approaching a real solution, I instead stuff it into a &#8220;static&#8221; session. By static, I just mean that I set the session ID to a static value, so I&#8217;m always pulling the same session. Instant data store.<\/p>\n<pre>session_id('stash-stuff-here');\nsession_start();\n$_SESSION['stuff'] = $w00tz;<\/pre>\n<p>(Another quick and dirty approach would be serializing an array into a local file&#8230; oh, wait, I just recreated the default PHP session handler. ;))<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here&#8217;s one of my favorite PHP &#8216;hacks&#8217;: when I&#8217;m whipping up a quick script that needs a place to stash some persistent data, but don&#8217;t feel like coming up with a database structure, or doing anything remotely approaching a real solution, I instead stuff it into a &#8220;static&#8221; session. By static, I just mean that [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7,11,20,23,30,32],"tags":[],"class_list":["post-190","post","type-post","status-publish","format-standard","hentry","category-development","category-hacks","category-php","category-programming","category-technology","category-tips"],"_links":{"self":[{"href":"https:\/\/blogs.n1zyy.com\/andrew\/wp-json\/wp\/v2\/posts\/190","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.n1zyy.com\/andrew\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.n1zyy.com\/andrew\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.n1zyy.com\/andrew\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.n1zyy.com\/andrew\/wp-json\/wp\/v2\/comments?post=190"}],"version-history":[{"count":0,"href":"https:\/\/blogs.n1zyy.com\/andrew\/wp-json\/wp\/v2\/posts\/190\/revisions"}],"wp:attachment":[{"href":"https:\/\/blogs.n1zyy.com\/andrew\/wp-json\/wp\/v2\/media?parent=190"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.n1zyy.com\/andrew\/wp-json\/wp\/v2\/categories?post=190"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.n1zyy.com\/andrew\/wp-json\/wp\/v2\/tags?post=190"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}