function drupal_get_query_array in Drupal 7
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
4 calls to drupal_get_query_array()
- DrupalGetQueryArrayTestCase::testDrupalGetQueryArray in modules/
simpletest/ tests/ common.test - Tests that drupal_get_query_array() correctly explodes query parameters.
- locale_language_url_rewrite_session in includes/
locale.inc - Rewrite URLs for the Session language provider.
- menu_edit_item_validate in modules/
menu/ menu.admin.inc - Validate form values for a menu link being added or edited.
- system_update_7076 in modules/
system/ system.install - Convert menu_links query strings into arrays.
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;
}