While reviewing a PHP function for a website that I am working on, I came across this codified version of Rambo (as a replacement for unset()):
function rambo() {
// Get the victims and initiate that body count statusn $victims = func_get_args();
$body_count = 0;
// Kill those punksn foreach($victims as $victim) {
if($death_and_suffering = @unset($victim)) {
$body_count++;
}
}
// How many kills did Rambo tally up on this mission?
return($body_count);
}
Unfortunately I can’t use it on $_SESSION, which was the reason for the research. From the session_unset() notes:
Do NOT unset the whole $_SESSION with unset($_SESSION) as this will disable the registering of session variables through the $_SESSION superglobal.
I could modify the function but it is simply easier to use session_unset(). In other news, I’m working on a web server that disables all browser caching by default. This means that every single image is downloaded for every single page. It’s a great way to eat up bandwidth. My fix was to override the cache-control header by adding this to my .htaccess file:
# Check for new images every day, but only once...
<FilesMatch "\.(png|jpg|gif)$">
Header set Cache-Control "max-age=86400, public"
</FilesMatch>