Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.3.x will end 7 October 2024 (12 months).
  • Bug fixes for security issues in 4.3.x will end 21 April 2025 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.2.x is supported too.

(no description)

File Size: 113 lines (4 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Query:: (2 methods):
  parse()
  build()


Class: Query  - X-Ref

parse(string $str, $urlEncoding = true)   X-Ref
Parse a query string into an associative array.

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'])`.

param: string   $str         Query string to parse
param: int|bool $urlEncoding How the query string is encoded

build(array $params, $encoding = PHP_QUERY_RFC3986)   X-Ref
Build a query string from an array of key value pairs.

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).

param: array     $params   Query string parameters.
param: int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986