Skip navigation
Help

drupal_get_query_array

7 common.inc drupal_get_query_array($query)

Split an 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

2 calls to drupal_get_query_array()

File

drupal/includes/common.inc, line 443
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);
      $result[$param[0]] = isset($param[1]) ? rawurldecode($param[1]) : '';
    }
  }
  return $result;
}