Skip to content

Instantly share code, notes, and snippets.

@AkostDev
Created February 15, 2022 05:00
Show Gist options
  • Save AkostDev/17d3a5d9c2f34b1d869f40c3523166d5 to your computer and use it in GitHub Desktop.
Save AkostDev/17d3a5d9c2f34b1d869f40c3523166d5 to your computer and use it in GitHub Desktop.
if (!function_exists('getallheaders')) {
function getallheaders(): array
{
$headers = [];
foreach ($_SERVER as $name => $value) {
if (str_starts_with($name, 'HTTP_')) {
$headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value;
}
}
return $headers;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment