W3cubDocs

/WordPress

Headers::offsetSet( string $offset, string $value )

Set the given item

Parameters

$offsetstringrequired
Item name
$valuestringrequired
Item value

Source

public function offsetSet($offset, $value) {
	if ($offset === null) {
		throw new Exception('Object is a dictionary, not a list', 'invalidset');
	}

	if (is_string($offset)) {
		$offset = strtolower($offset);
	}

	if (!isset($this->data[$offset])) {
		$this->data[$offset] = [];
	}

	$this->data[$offset][] = $value;
}

© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wporg-requests-response-headers/offsetset