public function buildQueryString(array $parameters, array $initialQueryParameters = [], $previousKey = null)
    {
        $queryParameters = $initialQueryParameters;

        foreach ($parameters as $key => $value) {
            if (null !== $previousKey) {
                $key = "{$previousKey}[{$key}]";
            }

            if (is_array($value)) {
                $queryParameters = $this->buildQueryString($value, $queryParameters, $key);
            } else {
                $queryParameters[] = "{$key}={$value}";
            }
        }

        return null !== $previousKey ? $queryParameters : implode('&', $queryParameters);
    }
public function buildQueryString(array $parameters, array $initialQueryParameters = [], $previousKey = null)
    {
        $queryParameters = $initialQueryParameters;

        foreach ($parameters as $key => $value) {
            if (null !== $previousKey) {
                $key = "{$previousKey}[{$key}]";
            }

            if (is_array($value)) {
                $queryParameters = $this->buildQueryString($value, $queryParameters, $key);
            } else {
                $queryParameters[] = "{$key}={$value}";
            }
        }

        return null !== $previousKey ? $queryParameters : implode('&', $queryParameters);
    }
public function buildQueryString ( array $ parameters , array $ initialQueryParameters = [ ] , $ previousKey = null ) { $ queryParameters = $ initialQueryParameters ; foreach ( $ parameters as $ key => $ value ) { if ( null !== $ previousKey ) { $ key = "{$previousKey}[{$key}]" ; } if ( is_array ( $ value ) ) { $ queryParameters = $ this -> buildQueryString ( $ value , $ queryParameters , $ key ) ; } else { $ queryParameters [ ] = "{$key}={$value}" ; } } return null !== $ previousKey ? $ queryParameters : implode ( '&' , $ queryParameters ) ; }
Build query string from the given parameters.

@param array  $parameters
@param array  $initialQueryParameters
@param string $previousKey

@return string
Build query string from the given parameters .