note 121178 deleted from function.getallheaders by peehaa
| From: | peehaa@php.net | Date: | Tue, 06 Jun 2017 09:52:37 +0000 |
| Subject: | note 121178 deleted from function.getallheaders by peehaa | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-209119@lists.php.net to get a copy of this message | ||
Note Submitter: vihar at videbligo dot com
----
It appears that in PHP 7.1, headers must be initialized as an array.
<?php
namespace vdb;
if (!function_exists('getallheaders')) {
function getallheaders() {
$headers = [];
foreach ($_SERVER as $name => $value) {
if (substr($name, 0, 5) == 'HTTP_') {
$headers[str_replace(' ', '-',
ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value;
}
}
return $headers;
}
}