public static function encodeQueryString(array $query, $rfc = self::RFC_3986)
    {
        $ret = [];
        $encode = self::getQueryStringEncoder($rfc);
        foreach ($query as $name => $value) {
            if (is_array($value)) {
                foreach ($value as $v) {
                    $ret[] = $name.'='.$encode($v);
                }
            }
            else {
                $ret[] = $name.'='.$encode($value);
            }
        }
        return implode('&', $ret);
    }
public static function encodeQueryString(array $query, $rfc = self::RFC_3986)
    {
        $ret = [];
        $encode = self::getQueryStringEncoder($rfc);
        foreach ($query as $name => $value) {
            if (is_array($value)) {
                foreach ($value as $v) {
                    $ret[] = $name.'='.$encode($v);
                }
            }
            else {
                $ret[] = $name.'='.$encode($value);
            }
        }
        return implode('&', $ret);
    }
public static function encodeQueryString ( array $ query , $ rfc = self :: RFC_3986 ) { $ ret = [ ] ; $ encode = self :: getQueryStringEncoder ( $ rfc ) ; foreach ( $ query as $ name => $ value ) { if ( is_array ( $ value ) ) { foreach ( $ value as $ v ) { $ ret [ ] = $ name . '=' . $ encode ( $ v ) ; } } else { $ ret [ ] = $ name . '=' . $ encode ( $ value ) ; } } return implode ( '&' , $ ret ) ; }
Create a url encoded string

php's `http_build_query` does a wacky job of handling arrays
@param array $query
@return string
Create a url encoded string