I ran the following experiment to compare arrays.
1 st - using (substr($key,0,5 == "HTTP_") & 2 nd - using (!strncmp($key, 'HTTP_', 5))
I wanted to work out the fastest way to get the first few characters from a array
BENCHMARK ITERATION RESULT IS:
if (substr($key,0,5 == "HTTP_").... -   0,000481s
if (!strncmp($key, 'HTTP_', 5)).... -     0,000405s
strncmp() is 20% faster than substr() :D
<?php
function strncmp_match($arr)
{
foreach ($arr as $key => $val)
    {
    if (!strncmp($key, 'HTTP_', 5))    
        {
    $out[$key] = $val;
        }
    }
return $out;
}
?><pre><?php
print_r(strncmp_match($_SERVER));
?></pre>
will display code like this:
Array
(
    [HTTP_ACCEPT] => XXX
    [HTTP_ACCEPT_LANGUAGE] => pl
    [HTTP_UA_CPU] => x64
    [HTTP_ACCEPT_ENCODING] => gzip, deflate
    [HTTP_USER_AGENT] => Mozilla/4.0 
                                    (compatible; MSIE 7.0;
                                     Windows NT 5.1;
                                    .NET CLR 1.1.4322;
                                    .NET CLR 2.0.50727)
    [HTTP_HOST] => XXX.XXX.XXX.XXX
    [HTTP_CONNECTION] => Keep-Alive
    [HTTP_COOKIE] => __utma=XX;__utmz=XX.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none)
)