code: public function getParams(array $params)
      {
          $r = '';
  
          ksort($params);
  
          foreach ($params as $key => $value) {
              $r .= '&' . $key . '=' . rawurlencode($value);
          }
  
          unset($params, $key, $value);
  
          return trim($r, '&');
      }
docs: Converting parameters array to a single string with encoded values
  
  @param array $params Input parameters
  @return string  Single string with encoded values