parseParameters.php
Table of Contents
Functions
- parseParameters() : array<string, string>
- Parses a parameter string of the form `key=value` pairs joined by an item separator, into an associative array.
Functions
parseParameters()
Parses a parameter string of the form `key=value` pairs joined by an item separator, into an associative array.
parseParameters(string $input[, string $itemSep = ';' ][, string $kvSep = '=' ][, bool $lowercaseKeys = false ]) : array<string, string>
Each segment is split by the first occurrence of $kvSep. Segments
with no $kvSep are treated as bare tokens whose value is ''.
Quoted values are unquoted with [[unquote]] (no escape decoding).
Splitting respects quoted regions via [[splitOutsideQuotes]], so a
separator appearing inside "…" (or any recognised quote pair) does
not break parsing.
Generic by design — no normalisation, no header-specific rules. For
RFC 7230 header parameters, wrap this with $lowercaseKeys = true.
Parameters
- $input : string
-
The string to parse.
- $itemSep : string = ';'
-
Separator between pairs (default
;). - $kvSep : string = '='
-
Separator between key and value (default
=). - $lowercaseKeys : bool = false
-
Whether to lowercase keys (default
false).
Tags
Return values
array<string, string> —The parsed parameters.