Hi,

I'm trying to format the request headers:

HTTP_ACCEPT
HTTP_ACCEPT_CHARSET
HTTP_ACCEPT_ENCODING
HTTP_ACCEPT_LANGUAGE
HTTP_CACHE_CONTROL
HTTP_CONNECTION
HTTP_COOKIE
HTTP_HOST
HTTP_KEEP_ALIVE
HTTP_REFERER
HTTP_USER_AGENT

into:

Accept
Accept-Charset
Accept-Encoding
Accept-Language
Cache-Control
Connection
Cookie
Host
Keep-Alive
Referer
User-Agent

Right now I'm doing it like so:

PHP Code:
preg_replace(
    
'/HTTP_(.*)/e'
    
'str_replace(" ", "-", ucwords(strtolower(str_replace("_", " ", "\1"))))'
    
array_values(preg_grep('/^HTTP/'array_keys($_SERVER)))); 
Is there a more efficient/less ugly/better way to do this?

Thanks!