PHP parse_str equivalent in golang


PHP parse_str equivalent in golang is url.ParseQuery

Example:

package main

import (
	"fmt"
	"net/url"
)

func main() {
    	m, err := url.ParseQuery("x=1&y=2&y=3")
	if err != nil {
        	panic(err) 
	}
	fmt.Println(m)
}

Result:

map[x:[1] y:[2 3]]

Leave a Reply