$value) { if (! is_string($key)) { continue; } if ($value === '') { continue; } // Apache prefixes environment variables with REDIRECT_ // if they are added by rewrite rules if (strpos($key, 'REDIRECT_') === 0) { $key = substr($key, 9); // We will not overwrite existing variables with the // prefixed versions, though if (array_key_exists($key, $server)) { continue; } } if (strpos($key, 'HTTP_') === 0) { $name = strtr(strtolower(substr($key, 5)), '_', '-'); $headers[$name] = $value; continue; } if (strpos($key, 'CONTENT_') === 0) { $name = strtr(strtolower($key), '_', '-'); $headers[$name] = $value; continue; } } return $headers; }