And even better one, that absolutely mimics getallheaders behaviour (including keynames - first character in each word is uppercase and words separated with '-' instead of underscore), and still does not use regexp:
<?php
function emu_getallheaders() {
foreach($_SERVER as $name => $value)
if(substr($name, 0, 5) == 'HTTP_')
$headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value;
return $headers;
}
?>