function drupal_get_query_array

drupal_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

includes/common.inc, line 457
Common functions that many Drupal modules will need to reference.

Code

function drupal_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;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!common.inc/function/drupal_get_query_array/7.x