All of the environment variables in this test are NOT set if they aren't part of the original request. The only one that is guaranteed to be set is REMOTE_ADDR, because it's set by the server hosting the PHP script.
By the way - why do you claim that they're always set, and still use isset() in your script? If that's the case, you could skip directly to your empty() test and cut your number of tests in half.
getenv() returns false if a value isn't set, allowing for the kind of ternary expression I posted.
You should read about it:
php.net/getenv