Epic Voyage logo

Epic Voyage

The Wanderer's Journal

Main menu

  • Home

Geek Stuff: Rambo Has Found a Computer

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>

Overheard at the Tavern

To pass lightly from old laws to new ones is a certain means to weakening the inmost essence of all law whatever. — Aristotle
Another »

Since This Page Loaded...

0 million dollars have been spent by Washington.
0.00 dollars per person in the US.

And that is only Federal spending...

0 babies have died worldwide in an abortion.
0 babies were in the United States.

0 Americans have contracted an STD.

About Me

{author}
Chris is probably out getting lost somewhere. He has a tendency to do that. Please don't worry unless he fails to show up again sometime in the next week.

Copyright 2024. All rights reserved.