Revision: 58430
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at July 14, 2012 02:02 by MonsterDev
Initial Code
public static function getMultipleParameters() { $query = $_SERVER['QUERY_STRING']; $vars = array(); $second = array(); foreach (explode('&', $query) as $pair) { list($key, $value) = explode('=', $pair); if('' == trim($value)){ continue; } /// Si il existe une clé (donc le parametre est multiple) if (array_key_exists($key, $vars)) { /// permet de réécrire le premier parametre a l'interieur du tableau if (!array_key_exists($key, $second)) $second[$key][] .= $vars[$key]; $second[$key][] = urldecode($value); } else { $vars[$key] = urldecode($value); } } return array_merge($vars, $second); }
Initial URL
Initial Description
This function allow you ti have multiple parameters in your query string. Ex : id=12&name=Doe&id=42&nickname=Monster
Initial Title
Uri multiple parameters
Initial Tags
url, query
Initial Language
PHP