Documentation

Query
in package

Table of Contents

build()  : string
Build a query string from an array of key value pairs.
parse()  : array<string|int, mixed>
Parse a query string into an associative array.

Methods

build()

Build a query string from an array of key value pairs.

public static build(array<string|int, mixed> $params[, int|false $encoding = PHP_QUERY_RFC3986 ]) : string

This function can use the return value of parse() to build a query string. This function does not modify the provided keys when an array is encountered (like http_build_query() would).

Parameters
$params : array<string|int, mixed>

Query string parameters.

$encoding : int|false = PHP_QUERY_RFC3986

Set to false to not encode, PHP_QUERY_RFC3986 to encode using RFC3986, or PHP_QUERY_RFC1738 to encode using RFC1738.

Return values
string

parse()

Parse a query string into an associative array.

public static parse(string $str[, int|bool $urlEncoding = true ]) : array<string|int, mixed>

If multiple values are found for the same key, the value of that key value pair will become an array. This function does not parse nested PHP style arrays into an associative array (e.g., foo[a]=1&foo[b]=2 will be parsed into ['foo[a]' => '1', 'foo[b]' => '2']).

Parameters
$str : string

Query string to parse

$urlEncoding : int|bool = true

How the query string is encoded

Return values
array<string|int, mixed>

Search results