Yanlış anladıysam düzeltin lütfen,
function get_header():string {
$a = array();
$ca = '/\AHTTP_/';
foreach($_SERVER as $key => $val):
if(!preg_match($ca, $key)) continue;
$b = preg_replace($ca, '', $key);
$c = explode('_', $b);
if(count($c) <= 0 || strlen($b) <= 2) continue;
foreach($c as $t => $g)
$c[$t] = ucfirst($g);
$b = implode('-', $c) ?? $b;
$a[$b] = $val;
endforeach;
$output = implode(' ',array_map(function($l, $b) {return sprintf("%s='%s'", $b, $l);},$a,array_keys($a)));
return $output ?? null;
}
$cad = get_header();
echo $cad;İstediğiniz bu değil mi ?