Aggregate multi-valued parameters using PHP style syntax
string $key The name of the query string parameter:
array $value The values of the parameter:
bool $encode Set to TRUE to encode field names and values:
array Returns an array of the combined values
public static function aggregateUsingPhp($key, array $value, $encode = false) {
$ret = array();
foreach ($value as $k => $v) {
$k = "{$key}[{$k}]";
if (is_array($v)) {
$ret = array_merge($ret, self::aggregateUsingPhp($k, $v, $encode));
}
else {
if ($encode) {
$ret[rawurlencode($k)] = rawurlencode($v);
}
else {
$ret[$k] = $v;
}
}
}
return $ret;
}