1 common.inc backdrop_get_query_array($query)

Splits a URL-encoded query string into an array.

Parameters

$query: The query string to split.

Return value

An array of URL decoded couples $param_name => $value.

Related topics

File

core/includes/common.inc, line 537
Common functions that many Backdrop modules will need to reference.

Code

function backdrop_get_query_array($query) {
  $result = array();
  if (!empty($query)) {
    foreach (explode('&', $query) as $param) {
      $param = explode('=', $param, 2);
      $result[$param[0]] = isset($param[1]) ? rawurldecode($param[1]) : '';
    }
  }
  return $result;
}