= 5.3.0, PHP 7) $by_function = function_exists('header_remove'); // Enum and clean foreach ($headers as $header) { list($k, $v) = array_map('trim', explode(':', $header, 2)); $by_function? @header_remove($k) : @header($k.':'); } } } }