You are here

function headers_from_lines in Lockr 7.3

Parses an array of header lines into an associative array of headers.

Parameters

array $lines Header lines array of strings in the following: format: "Name: Value"

Return value

array

File

vendor/guzzlehttp/guzzle/src/functions.php, line 63

Namespace

GuzzleHttp

Code

function headers_from_lines($lines) {
  $headers = [];
  foreach ($lines as $line) {
    $parts = explode(':', $line, 2);
    $headers[trim($parts[0])][] = isset($parts[1]) ? trim($parts[1]) : null;
  }
  return $headers;
}