Requests_Response_Headers::flatten() WordPress Method

The flatten() method of the Requests_Response_Headers class takes an array of headers and returns a single string containing the headers, separated by newlines. This is useful for displaying headers in a human-readable format.

Requests_Response_Headers::flatten( string|array $value ) #

Flattens a value into a string


Description

Converts an array into a string by imploding values with a comma, as per RFC2616’s rules for folding headers.


Top ↑

Parameters

$value

(string|array)(Required)Value to flatten


Top ↑

Return

(string) Flattened value


Top ↑

Source

File: wp-includes/Requests/Response/Headers.php

	public function flatten($value) {
		if (is_array($value)) {
			$value = implode(',', $value);
		}

		return $value;
	}

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.