Here’s one of my favorite PHP ‘hacks’: when I’m whipping up a quick script that needs a place to stash some persistent data, but don’t feel like coming up with a database structure, or doing anything remotely approaching a real solution, I instead stuff it into a “static” session. By static, I just mean that I set the session ID to a static value, so I’m always pulling the same session. Instant data store.
session_id('stash-stuff-here'); session_start(); $_SESSION['stuff'] = $w00tz;
(Another quick and dirty approach would be serializing an array into a local file… oh, wait, I just recreated the default PHP session handler. ;))